In my continuing work on reporting on US Census data for my 
neighborhood, I'd like to draw a map of the boundaries of it. I was 
successful in creating and printing an OSM basemap, with the US Census 
blocks that make up my neighborhood on it.

Now, I'd like to create my own polygon, of the boundaries of my 
neighborhood, because the census blocks don't line up exactly with the 
neighborhood boundaries. I need help creating a polygon that I can 
submit to read_osm() that will correctly return an OSM map of my area.

Here's what I've tried so far:
## Reproducible simple example:
library(tidyverse)
library(sf)

rw <- data.frame( ## Simplified neighborhood rectangle
     Longitude = c(-8528150, -8528500, -8528500, -8528150),
     Latitude  = c( 4771475,  4771475,  4771880,  4771880)
)

rw ## Returns (as expected):

 > rw
   Longitude Latitude
1  -8528150  4771475
2  -8528500  4771475
3  -8528500  4771880
4  -8528150  4771880
 >

rw %>%
     st_as_sf(coords = c("Longitude", "Latitude"), dim = "XY") %>%
     st_set_crs(6487) %>% ## CRS 6487 is NAD83 (2011) Maryland in meters
     st_transform(crs = 4269) ## CRS 4269 is NAD83

## Returns:

Simple feature collection with 4 features and 0 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: 171.777 ymin: 24.65904 xmax: 171.7818 ymax: 24.66314
Geodetic CRS:  NAD83
                    geometry
1 POINT (171.7818 24.66192)
2 POINT (171.7806 24.65904)
3  POINT (171.777 24.66026)
4 POINT (171.7781 24.66314)
 >

I expected the POINTS to look like:
1 POINT (-76.61246 39.35010)

Can anyone suggest what I'm doing wrong? Thanks so much in advance. I've 
worked on it all day today, without making much progress.

-Kevin

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to