0

I have columns in my data frame for longitude and latitude, which has specific coordinates such as:

longitude      latitude
-80.21148009   26.05230418
-96.70594765   40.82043599
...

How can I map the coordinate data I have with the corresponding city/region/state?

Ideally, this would be flexible; for example, I could map to the state-level if needed, or by zip code for another application.

I know there are some packages that can map cities to coordinates, but I haven't been able to find a method that can link coordinates to over-arching regions.

slava-kohut
  • 4,203
  • 1
  • 7
  • 24
AxW
  • 582
  • 1
  • 6
  • 20

1 Answers1

0

What you need is called reverse geocoding. There are multiple packages that will get you there. For example, you can use ggmap::revgeocode based off Google Geocoding and Places API. It needs your Google credentials to work:

ggmap::revgeocode(c(-80.21148009, 26.05230418))

See ?ggmap::revgeocode for details.

slava-kohut
  • 4,203
  • 1
  • 7
  • 24