3 ms·
Ask HN: What do you use for Geocoding?
I find I have a requirement to take a description, such as one would feed to Google, and convert it to Lat/Long. It need not be particularly accurate, a few miles is good enough. Given the wide range of interests and experience here on HN, I thought I'd ask if anyone here has done this, what they've used, and how well it worked.
So for example, given "Lady Lever Art Gallery" it could produce something like "53.35,-3.00" and that would be good enough. Or given something like "Golden Gate Bridge" it could return "37.81,-122.48"
Does anyone here do this? What do you use?
Currently this is for personal use, and would be limited to at most a few requests per week. I can use Google by hand, but if the project takes off then usage would increase, would need to be automated, and I would, of course, be willing to pay for an appropriate service.
Suggestions and comments welcome, especially descriptions of what you currently use, and your experience with it/them.
TIA.
- samlevy 13y agoI've been looking at the CloudMade Geocoding API for a side project and they return good results in the UK. The POI search might also be helpful but I haven't tried it yet. You get 100k free requests per month and then it's $15 per 100k. Their APIs are licensed under the Creative Commons Attribution 2.0 License. http://cloudmade.com/products/geocoding http://cloudmade.com/products/geocoding http://developers.cloudmade.com/projects/show/geocoding-http-api http://developers.cloudmade.com/projects/show/geocoding-http... http://cloudmade.com/api-terms-of-service http://cloudmade.com/api-terms-of-service
- ColinWright 13y agoFantastic - thanks - I'll take a look.
- ColinWright 13y agoSo I've registered with CloudMade. That was painless. Then ... It appears with CloudMade that to get an API key I have to pretend I'm building an APP, and have to have a web site describing my awesome new product. Then when I try to ask a question, I get all the way through the tedious process of constructing my question in their model of how a customer should behave, only to have to login with a completely different account! Google, Facebook, GetSatisfaction, something, but not the account I just registered with them. WTF?!?
- samlevy 13y agoIt is a bit rubbish but not as bad as other APIs I've had to register for (API keys pending review/approval for several days). I just filled in the bare minimum of App name and google.com for the App URL. Where are you trying to ask questions? I've been using their support email address.
- ColinWright 13y agoI tried clicking on the "Feedback" link on the left. When that didn't work, I've tried sending them email to their support address. In the meantime I've factored out and lifted all the GeoCoding from my application and added my own internal "API", so whatever service I end up using, I can switch fairly easily to another when necessary.
- ig1 13y agoTwo other options are the OpenStreetMap Geocoder (it's called Nominatim) and the FourSquare API.
- ColinWright 13y agoThanks - will investigate. Currently having a nightmare trying to find a registration service that actually works, and getting tired of creating new passwords for every login.
- wikwocket 13y agoNokia HERE map/geocoding UI. Lots of features, good developer documentation.
- ColinWright 13y agoThanks for that, but in truth, I don't want lots of features - I want to send a piece of text to a URI and get back a string from which I can pick out the lat/long. And you've given me no indication of how to find what you're recommending, apart simply from searching for the text "Nokia here map/geocoding". Is that what I should do to find it? Added in edit ... So now I've done that search and found a description. Based on your recommendation I decided to try it, so I clicked on the link on how to get my API credentials, and I got this: 404 Not Found Code: NoSuchKey Message: The specified key does not exist. Key: docs/maps_js/topics/credentials.html RequestId: 92390AF64837E443 HostId: <omitted> An Error Occurred While Attempting to Retrieve a Custom Error Document Code: NoSuchKey Message: The specified key does not exist. Key: /error.html This seems typical - things just don't work.
- wikwocket 13y agoSorry, I don't have my code/notes with me, but I wanted to put the link out there. Nokia has tons of developer resources so it can be hard to find what you need. I will try to remember to post more later, but for now here is a basic geocoding example: http://developer.nokia.com/Community/Wiki/HERE_Maps_API_-_Using_the_geocoding_service http://developer.nokia.com/Community/Wiki/HERE_Maps_API_-_Us...
- ColinWright 13y agoSorry I'm so grumpy, but I'm getting various suggestions from various places, and my experiences are, to say the least, unhappy ones. This is a typical example. All looks well, then you follow a link to start using it, and you get a 404, or an access denied, or some other message that just brings you to a dead stop. Thanks for the suggestion - I'll return to it later and see if it's been fixed.
- cinquemb 13y agoI have done something similar with with a python script that basically: - parsed locations from an html file and stored them in a list - parsed them into this url: 'https://maps.google.com/maps?q=%s' https://maps.google.com/maps?q=%s' % (location) -parsed the html for an address -parsed the address into this url: 'https://maps.google.com/maps/api/geocode/json?address=%s&sensor=false' https://maps.google.com/maps/api/geocode/json?address=%s&sen... % (address) -parse the coordinates I used it to get oil refineries in the united states and it worked pretty well… i can put it on github if you would like. It probably can also be done between the front-end and back-end with a little bit of trickery (the calls to google on the front-end, POST'ed html processing on the back from the front-end), so that users ip is using the service and not the servers.
- ColinWright 13y agoThat's very similar to what I've been doing so far, but it's broken again, so I'm looking for something less fragile and more "official" so I can stop having to fix it every few months, or every few weeks. I'll probably fix it this time while I'm searching for something more robust. Thanks.
- cinquemb 13y agoGood luck with your search, everything seems so fractured when it comes to doing things like this. I'm curious, how does your method break? Is it the query string not finding any results to a location, wrong locations, or something else?
- ColinWright 13y agoI've been sending query to: 'https://maps.google.com/maps?q=%s' % sanitise(location) and then parsing the result to find the lat/lng. However, this isn't an "official" way of doing it, and the format of the html has changed. The result used to match this: 'viewport_center_lat=([-0-9.]*);var viewport_center_lng=([-0-9.]*)' but now it looks like this: 'latlng:{lat:([-0-9.]*),lng:([-0-9.]*)}' Yes, I'm using regexs to parse HTML. However, now that's working again, but I might switch to the explicit two phase process used in https://news.ycombinator.com/item?id=6058751 https://news.ycombinator.com/item?id=6058751 - or I might directly use the second link mentioned there, instead of calling the URL I currently use. Does that all make sense?