Can I get a city and state out of a list of latitude/longitude pairs?
-
I've found a lot of folks that promise the opposite. What I want to do is take a csv of lat/long pairs and get back something pairing them with the corresponding city and state. (I'd even take zip codes if it came to that bit that would be somewhat less useful). Is this something easily done?
-
Answer:
OpenStreetMap has a http://wiki.openstreetmap.org/wiki/Nominatim#Reverse_Geocoding_.2F_Address_lookup. Seems simple enough.
Karmakaze at Ask.Metafilter.Com Visit the source
Other answers
This http://www.findlatitudeandlongitude.com/batch-reverse-geocode/#.VCmn_vldXTc site might do the trick.
JDHarper
That API Poldo mentioned looks pretty sweet. If for some reason you don't want to use their API, I think an R programmer could do something like this pretty quickly with open-source resources.
paper chromatographologist
I think where I'm failing is figuring out how to automate the process for a long list, that is, how to feed a list into one of these and get a list out instead of doing it one by one. I know it should be simple, but...
Karmakaze
Zip code lists have the lat/long of some point in the middle of the zip code area, as well as the municipality name. It would be simple to write as program to find the name of the town associated with the nearest zip code, but it would not be 100% correct for what you want. I'm talking here of a list with a list of about 50,000 5-digit zip codes. There are also much bigger lists. I have not worked with them, but I suppose the are for zip+4. If that has lat/long, it would be pretty accurate.
SemiSalt
ISTR finding an option somewhere on Google Earth where you can upload a spreadsheet of Lat/Long and get it automatically plotted. Seems to me, you could then take that data and have it spit out your city/state information, assuming you can export the data from Google Earth.
suelac
1. Download Urban Areas shapefile from http://www.census.gov/cgi-bin/geo/shapefiles2013/layers.cgi. 2. Unzip that file 3. Download rStudio and install it from http://www.rstudio.com/. 4. Open rStudio and run http://pastebin.com/mXxLCkGq
one_bean
I'm getting this: > require(rgdal) Loading required package: rgdal Loading required package: sp rgdal: version: 0.9-1, (SVN revision 518) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 1.11.0, released 2014/04/16 Path to GDAL shared files: C:/Users/rudysx/Google Drive/Documents/R/win-library/3.1/rgdal/gdal GDAL does not use iconv for recoding strings. Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480] Path to PROJ.4 shared files: C:/Users/rudysx/Google Drive/Documents/R/win-library/3.1/rgdal/proj Warning messages: 1: package ‘rgdal’ was built under R version 3.1.1 2: package ‘sp’ was built under R version 3.1.1 > cities Error: '\G' is an unrecognized escape in character string starting ""F:\G" > layer="tl_2013_us_uac10") Error: unexpected ')' in " layer="tl_2013_us_uac10")" > > my.pts Error: '\G' is an unrecognized escape in character string starting ""F:\G" > # Make sure your csv is only two columns, longitude and then latitude > # These aren't projected coordinates, right? > > my.sp.pts Error in coordinates(coords) : error in evaluating the argument 'obj' in selecting a method for function 'coordinates': Error: object 'my.pts' not found > my.sp.pts@proj4string Error: object 'cities' not found > > #This next line will take a while to run > my.pts$city Error in over(my.sp.pts, cities) : error in evaluating the argument 'x' in selecting a method for function 'over': Error: object 'my.sp.pts' not found > write.csv(my.pts, "my_new_city_file.csv") Error in is.data.frame(x) : object 'my.pts' not found > >>>>>
Karmakaze
Two things. R doesn't like backslashes so you need two in a row, or use forward slashes instead. it looks like your code is messed up, too, but I'm guessing the formatting just got screwy when you pasted over here. But double check that what you're running in R matches what's in my code link.
one_bean
Related Q & A:
- How do I get a New York state driver's license?Best solution by Yahoo! Answers
- Can I get a P.O. box in another state?Best solution by answers.yahoo.com
- Can I get accepted to Oregon State University?Best solution by collegesimply.com
- Where can I get a cheap microphone to clip to a camera?Best solution by bestbuy.com
- How can I get a job at a resort for a Summer?Best solution by eHow old
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.