Eduardo,

I haven’t used R for anything GIS so anyone with more knowledge is welcome to correct me, but I do work with GIS quite a bit. You may look for a function that creates polygons (instead of points), where you use these coordinates as the
vertices of your polygons. I suggest this because in GIS points and polygons are two very different things. You may also find that you can create polygons with extents, in which case you would use just the relevant half of your point coordinate to indicate
your NESW extent.

**From:** UF R Users List <[log in to unmask]> **On Behalf Of
**Schmitz Bongiolo,Eduardo

**Sent:** Wednesday, December 5, 2018 1:45 PM

**To:** [log in to unmask]

**Subject:** Convert points into a polygon sf

Dear R community,

I am creating a map using R (prod_mapv12_fruit.png), but now I cannot figure it out how to draw the squares of the zoom-in in the middle map.

I have the coordinates of the edges for the two polygons I want to draw but cannot make them into a square. When I plot them, it only plots four dots.

**# attempt one **importing the data using a CSV file. In this case, I could not find a predefined function to transform the points in a polygon.

zoom_square <- read.csv("zoom_square.csv")

zoom_square_1<- zoom_square %>%

filter(square == "A") %>%

select(X,Y)

zoom_square_2<- zoom_square %>%

filter(square == "B") %>%

select(X,Y)

plot(zoom_square_1)

plot(zoom_square_2)

**# attempt two**: this was a suggestion I find in the internet, but could not make it work.

zoom_square_1<- rbind(c(-10.821079,-68.403542),

c(-10.862918,-68.367060),

c(-10.821079,-68.367060),

c(-10.862918,-68.403542))

zoom_square_1_pol <- st_polygon(list(zoom_square_1))

Once the points are converted to polygons I can add the Coordinates reference system and plot them into the map.

__To summarize, I want help to convert these two sets of four points into two squares (polygons) that can be used with ggplot2::geom_sf().__

Best regards,

Eduardo S. Bongiolo

Masters student

School of Forest Resources and Conservation

University of Florida

This list strives to be beginner friendly. However, we still ask that you PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.