Using Nominatim (Search engine for OpenStreetMap data)
Posted: Wed May 31, 2017 3:39 pm
Hello,
Nominatim is a search engine for OpenStreetMap data.
Here's a simple snippet how to use it:
And here is another demo: http://spiderbytes.tuebben.de/demos/Nominatim/
Greetings ... Peter
Nominatim is a search engine for OpenStreetMap data.
Here's a simple snippet how to use it:
Code: Select all
EnableExplicit
Structure sResult
place_id.s
licence.s
osm_type.s
osm_id.s
boundingbox.i
lat.s
lon.s
display_name.s
class.s
type.s
importance.s
icon.s
polygonpoints.s
geojson.i
EndStructure
Global NewList Results.sResult()
Procedure NominatimCallback(Result.s)
ParseJSON(0, Result)
ExtractJSONList(JSONValue(0), Results())
If ListSize(Results()) > 0
ForEach Results()
Debug "Displayname: " + Results()\display_name
Debug "Class: " + Results()\class
Debug "Latitude: " + Results()\lat
Debug "Longitude: " + Results()\lon
Debug "-----"
Next
Else
Debug "no results..."
EndIf
EndProcedure
Procedure Nominatim(Address.s, Callback)
! $.get(location.protocol + '//nominatim.openstreetmap.org/search?polygon_geojson=1&format=json&q='+v_address, function(result) {
! v_callback(JSON.stringify(result));
! });
EndProcedure
CompilerIf #PB_Compiler_Debugger = 1
Nominatim("London", @NominatimCallback())
CompilerElse
! alert("please enable the debugger!");
CompilerEndIf
Greetings ... Peter