Hi Sven,
thanks for your fast response and the snippets. I scanned the different
geocoder classes from "geopy" and also the OSM Nominatim docs. Indeed,
it is not hard, ..... but if there is already a package, why not using
it :-)
maybe i start to write such a lib.
Thanks,
Volkert
Am 29.04.2017 um 15:54 schrieb Sven Van Caekenberghe:
Hi Volkert,
On 29 Apr 2017, at 15:01, volkert <volk...@nivoba.de> wrote:
Dear all,
do we have a package to access the a geocoder service? Something similar to
"geopy".
Volkert
As far as I know there is no such library.
We have it internally, but that part is not open source. But it is not so hard
to do yourself.
Here is an example for forward geocoding (address -> coordinates):
ZnClient new
url: 'http://nominatim.openstreetmap.org/search';
queryAt: #format put: 'json';
queryAt: #addressdetails put: '1';
queryAt: #q put: 'Villerspark 5, 3500 Hasselt';
queryAt: #countrycodes put: 'be';
accept: ZnMimeType applicationJson;
contentReader: [ :entity | STONJSON fromString: entity contents ];
get.
Here is an example for reverse geocoding (coordinates -> address):
ZnClient new
url: 'http://nominatim.openstreetmap.org/reverse';
queryAt: #format put: 'json';
queryAt: #lon put: 5.33732 asString;
queryAt: #lat put: 50.926 asString;
accept: ZnMimeType applicationJson;
contentReader: [ :entity | STONJSON fromString: entity contents ];
get.
These are against the OpenStreetMap Nomatim service, others are similar.
HTH,
Sven