MATLAB: Get GPS location from coordinates

coordinatesgpslocatelocation

Is there anyway that I can get Matlab to tell me a location based on the input of GPS coordinates? So, for example, if I gave it the coordinates (42.3899, -89.0366), how can I get Matlab to tell me that that's Roscoe, Illinois?

Best Answer

There are several solutions, depending the amount of data that you have to process, the time that you are willing to spend on coding, the time that you can afford spending on processing data, etc. You have two main options (there might be newer tools that I am not aware of though):
1. You can use e.g. a dataset of cities with their coordinates (Shapefile, Excel file, DBF file, etc), and just look for the minimal distance between a point and cities locations. This has the advantage that it is fast and local (no internet), but the disadvantage that you probably won't find a dataset with finer information than significant town/cities. You might also need to buy a license for using "high quality" datasets (I don't know if you could use ESRI datasets without a license for example). EDIT: here are a few relevant links:
  • ESRI Data and Maps (your university/company might have a site license for ArcGIS and DVDs for Data and Maps).
  • Boutell Zip/Lat/Lon Database: here.
  • Another "similar" here.
  • GeoNames, that could be placed in the next category of solutions, but their data is available here as text files.
2. You can use some online service/API and manage sending requests and processing responses (XML, etc). This has the disadvantage that it requires an internet connection and that sending/processing requests/responses can be time consuming, especially if you have a limited access to the API (number/rate of requests). It has the advantage though that you can get much more information, because APIs can give you access to very large databases (e.g. Google). Here are a few relevant links:
FEX (untested, because I usually build my own tools on this matter):
EDIT: to illustrate the issue with local datasets, here is the ESRI Data&Maps 9.3 dataset of 3557 cities. As you can see, if you have locations in e.g. Alaska, Montana, Nevada, chance is that the closest city will be quite far according to this dataset..