I have a dataset of about a million addresses. I was tasked with finding the latitudes and longitudes of all these addresses. I finished doing that (took about a week and about $3000 in credit card charges). But when doing a random manual check, I noticed that quite a few addresses have identical latitudes and longitudes returned. I thought, that can't be right. So I put some of these addresses manually in maps.google.com, and found that, yes, indeed the coordinates returned by the API for these are wrong.

So, among a million records, how do I programmatically determine which coordinates are wrong? I've thought a lot, and checked the dataset a lot, and I can't find any pattern among the addresses for which wrong coordinates are returned - no special characters in all of them (few of them do have, but other addresses with special characters have correct coordinates), no particular country, no regular misspellings in those addresses, etc.

I don't want to have to geocode the whole dataset and spend another 1 week and $3000 - if possible, i would like to identify the wrong ones and rerun the code for only them. From my random checkings, I would guess around 20% of the locations have wrong coordinates. If only I could find a way to identify them.

As an aside, are there other services which are free and return good quality of results? I tried using open street maps, but I found that for the addresses in my dataset, it was not able to return coordinates for almost half of them (due to the detail in the addresses).

  • The Google Maps Geocoding API result include formatted_address & location_type. Did you save these as well? Those are quite helpful to understand what went wrong – Devdatta Tengshe Aug 2 '18 at 11:44
  • Yes, I saved those as well. In fact, I saved the entire JSON it returns, and am extracting the lat and lon values from it later. For the incorrect coordinates, formatted_address contains the address of the returned lat and lon values. – Kristada673 Aug 2 '18 at 14:55
  • You can then compare the formatted_address with the input address and see how well it matches. – Devdatta Tengshe Aug 3 '18 at 6:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.