Obtaining the geolocation coordinates of a location specified by query string can be achieved using calls to geocoding APIs directly in a browser address box, or with a wrapping library such as geopy.
- Nominatim: OpenStreetMaps
- GoogleV3: Google Map & Places API
- ArcGis: ERSI ArcGIS API
- AzureMaps: Microsoft Azure Maps API
In another application, I was using the New York City boroughs bounding boxes to impute missing borough names for records with geolocation information (via set operations). The most expert GIS users among you would certainly predict scattershot results from such a "corner-cutting" approach, but initially I thought mine was a great way to prevent over 85,000 requests... Until I found out about the official territorial boundaries (shapefiles): then I trashed the box solution!
Yet, in the intervening time I had checked several services for speed and limits and I found out response differences between some geocoders...for the same query, so I investigated!
The Procedures notebook shows how to retrieve the data and call the functions.
Because I noticed that the results from this April were different from those from last September (2018), I put together an HTML report highlighting the differences.
I've implemented the "sliderReport.html" by modifying a "JS-less CSS slider" designed by GH user drygiel"
Thank you, drygiel!
- Who is the best of all four?
- Nominatim: Star of the glorious open-source community (see the data on Cleopatra's Needle in Central Park);
- GoogleV3: not OS, but similar results to Nominatim
- ArcGis: the least wrong of the worse two
- AzureMaps: Oh come on! 😖
-
No hedging! I presume that it is very unlikely that an application would use different geolocating services, but in the case some 'hedging' is involved (e.g. on limits, time-outs), the geolocation for the same query will be different.
-
Mind the box! Additionally, my non-exhaustive comparison of four Geopy geocoders (out of 21), reveals that the boxing of a location is not always principled. For instance, Nominatim and GoogleV3 most often use the shapefile with water extent for boxing, whereas ArcGis and AzureMaps do not; moreover, ArcGis boxes typically extend further North than warranted by the existing shapefiles by at most 10 miles.
Out of curiousity, I wonder how AzureMaps would fare against all geocoders...
Speaking of which:
At the time of this report, April 2019, there are 21 geocoding services available in geopy (excluding What3Words):
The number of pairwise comparisons needed is 210. This would require 51 more reports like this one, which uses the python code in GeocoderComparison that compares only four geocoders.