Skip to content

Instantly share code, notes, and snippets.

@baygross
Last active May 22, 2019 10:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baygross/5430626 to your computer and use it in GitHub Desktop.
Save baygross/5430626 to your computer and use it in GitHub Desktop.
The default 'maps' package for R contains bounded polygons defining various regions around the world. One such region is Manhattan, although in this instance the polygon points are shifted off of the island's true location by a significant degree. In some use-cases, this discrepancy may prove unacceptable. Actual bounding coordinates for Manhatt…
lat long
40.700292, -74.010773
40.707580, -73.999271
40.710443, -73.978758
40.721762, -73.971977
40.729568, -73.971291
40.733503, -73.973994
40.746834, -73.968072
40.775114, -73.941936
40.778884, -73.942580
40.781906, -73.943589
40.785351, -73.939362
40.789640, -73.936272
40.793149, -73.932238
40.795228, -73.929491
40.801141, -73.928976
40.804877, -73.930907
40.810496, -73.934298
40.834074, -73.934383
40.855371, -73.922281
40.870690, -73.908892
40.878348, -73.928289
40.851151, -73.947258
40.844074, -73.947086
40.828229, -73.955498
40.754019, -74.008713
40.719941, -74.013863
40.718575, -74.013605
40.718802, -74.017038
40.704977, -74.020042
40.700553, -74.016438
library(maps)
all_states <- map_data('state')
ny <- subset(all_states, subregion %in% c( "manhattan") )
print ny
# =>
# long lat group order region subregion
# 9050 -73.92874 40.80605 34 9050 new york manhattan
# 9051 -73.93448 40.78886 34 9051 new york manhattan
# 9052 -73.95166 40.77741 34 9052 new york manhattan
# 9053 -73.96312 40.75449 34 9053 new york manhattan
# 9054 -73.96885 40.73730 34 9054 new york manhattan
# 9055 -73.97458 40.72584 34 9055 new york manhattan
# 9056 -74.00323 40.71438 34 9056 new york manhattan
# 9057 -74.02042 40.70865 34 9057 new york manhattan
# 9058 -74.02615 40.72011 34 9058 new york manhattan
# 9059 -74.00323 40.76595 34 9059 new york manhattan
# 9060 -73.97458 40.79460 34 9060 new york manhattan
# 9061 -73.95166 40.83470 34 9061 new york manhattan
# 9062 -73.93448 40.84044 34 9062 new york manhattan
# 9063 -73.92874 40.83470 34 9063 new york manhattan
# 9064 -73.93448 40.82324 34 9064 new york manhattan
# 9065 -73.92874 40.80605 34 9065 new york manhattan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment