Nominatim (Suchmaschine für OpenStreetMap-Daten)
Verfasst: 05.07.2017 00:41
				
				Hallo,
Nominatim ist eine Suchmaschine für OpenStreetMap-Daten.
Hier ist ein simples Beispiel, wie man Nominatim in SpiderBasic nutzen kann:
Hier ist eine weiter Demo: http://spiderbytes.tuebben.de/demos/Nominatim/
Grüße ... Peter
			Nominatim ist eine Suchmaschine für OpenStreetMap-Daten.
Hier ist ein simples Beispiel, wie man Nominatim in SpiderBasic nutzen kann:
Code: Alles auswählen
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!");
CompilerEndIfGrüße ... Peter
