I want to build an location based application,
and I don't know how to get some location data, like:
the latitude and longitude of nearby starbucks, KFC, or pizza?
Is there any free database on the internet?
how does others get those data? like yelp, foursquare?
Openstreetmap has quite a few POI in their database i think, check out their rendered map if it does contain the info you need.
Oh, and you need around 100GB for the full db :)
Related
For a travel-related app idea I have it would be great to not only determine the user's location, but also if any other countries are near that location.
Are there any options that make something like this possible?
Have a look at these open-sourced Geo JSON libraries on GitHub.
https://github.com/topojson/world-atlas
https://github.com/johan/world.geo.json
https://github.com/topojson/us-atlas
There are lots of existing questions relating to this issue, but I have looked at as many of them as I could find and did not get an answer.
I'm trying to perform an offline reverse geocoding lookup on iOS based on a latitude and longitude. I'd like to be able to provide a latitude and longitude, and be provided with the country in which that point lies. I can do this with Geonames (such as: http://api.geonames.org/countryCode?lat=45.03&lng=8.2&username=demo), but I need a similar ability offline, without Internet functionality on the device.
CLLocation does not provide offline services that work reliably enough for what I'm doing, it relies on caches made while you were previously online, etc. Messy.
I've tried this: https://github.com/drodriguez/reversegeocoding but haven't had any luck, it requires some slightly complex / confusing Terminal installations using something called Thor which I've never heard of, and was throwing up a variety of errors, so I bailed on it.
I've found a few downloadable maps, but these seem to be even more complicated, and worryingly, hundreds of megabytes or even gigabytes in size – much beyond the scope of an iOS app. I only need countries, nothing smaller than that (cities, streets, locations, etc.) so I think I should be able to get a much smaller file.
So my key question is: is there some pre-existing database or tool, preferably with iOS support, that I can feed a latitude/longitude, and get a country? And, if not, what steps should I take to get such functionality working on my own?
Thanks in advance.
ReverseGeocodeCountry is a simple lightweight offline country reverse geocoder for iOS, it has a static JSON file with country polygon data that is used to reverse geocode any lat/lng:
https://github.com/krisrak/ios-offline-reverse-geocode-country
The "Countries of the World" is a .csv text file with countries, coordinates, localised country names, capitals and other information. It seems to be free to use. You just have to import it into an SQLite database.
Edit Just noticed you want reverse geocoding. The database would only be good for forward geocoding.
You can download shapefiles for all countries at http://www.gadm.org/download. If you download a .kmz, you can unpack it to a list of coordinates for the borders. You could probably take every 5th or 10th coordinate to get smaller size (with less accuracy).
Just in case I can suggest another good written offline geocoding library.
https://github.com/Alterplay/APOfflineReverseGeocoding
I want to be able to run queries locally comparing latitude and longitude of locations so I can run queries for certain addresses I've captured based on distance.
I found a free database that has this information for zip codes but I want this information for more specific addresses. I've looked at google's geolocation service and it appears it's against the TOS to store these values in my database or to use them for anything other than doing stuff with google maps. (If somebody's looked deeper into this and I'm incorrect let me know)
Am I likely to find any (free or pay) service that will let me store these lat/lon values locally? The number of addresses I need is currently pretty small but if my site becomes popular it could expand quite a bit over time to a large number. I just need to get the coordinates of each address entered once though.
This question hasn't received enough attention...
You're correct -- it can't be done with Google's service and still conform to the TOS. Cheers to you for honestly seeking to comply with the TOS.
I work at a company called SmartyStreets where we process addresses and verify addresses -- and geocode them, too. Google's terms don't allow you to store the data returned from the API, and there's pretty strict usage limits before they throttle or cut off your access.
Screen scraping presents many challenges and problems which are both technical and ethical, and I don't suppose I'll get into them here. The Microsoft library linked to by Giorgio is for .NET only.
If you're still serious about doing this, we have a service called LiveAddress which is accessible from any platform or language. It's a RESTful API which can be called using GET or POST for example, and the output is JSON which is easy to parse in pretty much every common language/platform.
Our terms allow you to store the data you collect as long as you don't re-manufacture our product or build your own database in an attempt to duplicate ours (or something of the like). For what you've described, though, it shouldn't be a problem.
Let me know if you have further questions about address geocoding; I'll be happy to help.
By the way, there's some sample code at our GitHub repo: https://github.com/smartystreets/LiveAddressSamples
http://www.zip-info.com/cgi-local/zipsrch.exe?ll=ll&zip=13206&Go=Go could use a screen scraper if you just need to get them once.
Also Microsoft provides this service. Check if this can help you http://msdn.microsoft.com/en-us/library/cc966913.aspx
I'm writing a web application using the google maps api v3, which displays places of interest for my customers. These won't be places which appear on google maps, and I want users to be able to filter the results to match their specific needs.
I've got it working so that the map centres on the user's current location on load. However, it does allow them to type in another address if they wish. When I do this, the map default to results in the American region.
Is there any way to get the region parameter for the map from the user's current location and use this to get more relevant results?
Another function I would like to implement is searching only for results within a certain (user-specifiable) distance from the given location. Currently all the places are stored in a MySQL database (with their address, latitude and longitude) and I iterate through all places and use this formula to determine the distance. I anticipate that I might get 50,000 places in the database.
Should I be worried about response time for this calculation, and is there a way I can make it quicker? Is having my data stored in a MySQL database a good idea in general for this kind of application?
Biasing geocoder results:
To bias the geocoder results, you can use navigator.language as the region parameter. It should provide more relevant results to the user.
Other way to improve the results might be by using the user's current location. You can use viewport biasing to improve the results (you can calculate some bounding box around the user's current location).
Using user's current location to acquire value for the region parameter is problematic. I'm not aware if there is some public API to acquire IANA language subtag from a location. But you can use the reverse geocoder to translate the location, then extract a country code from the results. The problem is that some country codes doesn't match the IANA language subtags that are required (e.g. ca is the country code for Canada but language subtag for Catalan, Valencian). However most of the time using the country code instead of language subtag should improve the results.
Storing latlng in MySQL db:
I'm afraid that iteration through all places and applying the Haversine formula might be very time consuming (some study about it here).
Probably the best way to handle laglng data in MySQL is to use spatial extensions. A nice blog post about using it.
I have a list of 200 some addresses. I used geocommons to convert these addresses into long/lat coordinates in kml and gpx format. I need to generate a map by connecting all the points to create a path. What would be the best way to do this? Is there a service that automatically does this, or should I dabble into something like the google maps API?
You need links between the nodes to calculate some kind of path. To get a realistic path for say a car or a person you need a accurate road data. This is normaly something you pay for, at least where I come from, but maybe there some way to get it for free.
If you get the road data it will probably not in wgs84, rather in some local or national system and you probably have to convert your point in to that other coordinate system.
To do the calculations you could use some kind of "GIS-tool" like the Open Source QGIS. I'm not cure if they got a one-click solution for your problem but I believe you can solve it with this tool. There are also well-defined algoritms to solve it by hand, just search for Traveling Salesman Problem.
Regards