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.
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") %>%
zoom_square_2<- zoom_square %>%
filter(square == "B") %>%
# attempt two: this was a suggestion I find in the internet, but could not make it work.
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().
Eduardo S. Bongiolo
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.