TransmogrifAI
TransmogrifAI copied to clipboard
Geolocation to Country transformer
Problem We would like to be able to treat GeoLocation values as categorical features.
Solution
Add unary transformer to convert Geolocation
values into Country
.
Alternatives N/A
Working on this.
Is the idea to use a reverse geolocation service?
http://www.geonames.org/export/web-services.html#countrysubdiv OR https://developers.google.com/maps/documentation/geocoding/start?csw=1#ReverseGeocoding
@ybh6336 the idea is to use some kind of a binary file containing the information of geolocation -> country code (@ybh6336 do you know of any good one?). But we would provide an interface for users to replace is with a remote service if needed.
@tovbinm I stumbled across the following projects which do offline reverse geocoding. Do these look in line with what you were thinking?
https://github.com/AReallyGoodName/OfflineReverseGeocode (java) https://github.com/thampiman/reverse-geocoder (python)
Yes, but if possible simpler ;) For a start we would like to have a transformer to return a country code from a pair of coordinates.
Hello! I'm just getting started with TransmogrifAI and I'd love to work on this issue. I see a couple of attempts marked 'Closed,' but this issue is still marked 'open.' Is this issue still accepting solutions?
We closed those cause there were no use-case for us to support exploration of this direction further.
You can have a look of what I did https://github.com/salesforce/TransmogrifAI/pull/227. It was based on the idea of mapping each (lat,lon) coordinate to the nearest city, and then assuming the country of that city as the result. This approach would operate correctly on majority of coordinates, but still have some edge cases.
An alternative approach was to locate a encoded country borders map, convert it to convex polygons, then query which polygon contains each location. Unfortunately no good source of publicly accessible country borders was found.
Got it, thanks so much! I'll get back to this if I find a reliable public service, and I'll look into other issues to fix or features to implement. :-)