Get GPS location from coordinates?
20 views (last 30 days)
Show older comments
Jacqueline
on 29 Jul 2013
Answered: Gholamreza Akbarizadeh
on 11 Dec 2019
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?
4 Comments
Walter Roberson
on 7 Jan 2019
Sakina Jafferi: in theory anyone who is not banned by court order or government regulation from providing you with code, could provide the code you requested . In practice it is unlikely that anyone would bother. If the code is available through search engines then you can do the search since you are the person who needs the results. If the code is not available through search engine then providing the code would take significant research and coding and testing , and it is unlikely that anyone would volunteer to do all that work on behalf of someone who has given no indication that they have put in any effort themselves . The people who have the skills and experience to code that efficiently and who are frequent volunteers are likely to also have the experience to recognize the task as being typical of a topic assigned as a 4th year honours project .
Accepted Answer
Cedric
on 29 Jul 2013
Edited: Cedric
on 29 Jul 2013
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:
- https://developers.google.com/maps/documentation/geocoding/?csw=1
- Example with your coordinates: http://maps.googleapis.com/maps/api/geocode/json?latlng=42.3899,-89.0366&sensor=true
FEX (untested, because I usually build my own tools on this matter):
- http://www.mathworks.com/matlabcentral/fileexchange/24126-google-geocode-api
- http://www.mathworks.com/matlabcentral/fileexchange/22565-yahoo-geocode-api
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..
8 Comments
Cedric
on 30 Jul 2013
You're welcome; let me know if you get stuck wrapping all that together. Parsing XML is not the easiest thing to do as it is based on tools which are not fully documented.
More Answers (1)
Gholamreza Akbarizadeh
on 11 Dec 2019
Hello all.
Using API keys is a restriction, and I think it is not an efficient way for an App. Is it another way to simply read the data form Google Map as a url, and get the location name specified by GPS coordinates?
Regrads.
0 Comments
See Also
Categories
Find more on Mapping Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!