Maps with SpiderBasic

Just starting out? Need help? Post your questions and find answers here.
User avatar
Paul
Posts: 197
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Maps with SpiderBasic

Post by Paul »

Anyone have any experience using Leaflet with SpiderBasic?
https://leafletjs.com/

Or have some examples of converting the javascript to use with SpiderBasic?
User avatar
Peter
Posts: 1093
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Maps with SpiderBasic

Post by Peter »

User avatar
Paul
Posts: 197
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: Maps with SpiderBasic

Post by Paul »

Wow :shock:
Thanks Peter, that's exactly what I was looking for.

(Note: the LeafletDemoGoogleMaps displays a blank screen but the other examples are excellent)
User avatar
Peter
Posts: 1093
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Maps with SpiderBasic

Post by Peter »

Paul wrote:Note: the LeafletDemoGoogleMaps displays a blank screen
Fix:

Code: Select all

EnableExplicit

XIncludeFile "Leaflet.sbi"

Enumeration
  #Window
  #LeafletGadget
EndEnumeration

Procedure Main()
  
  OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 900, 900, "LeafletGadgetDemo", #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
  
  ContainerGadget(#LeafletGadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window)) : CloseGadgetList()
  
  Leaflet::BindGadget(#LeafletGadget)
  
  Protected myMap = Leaflet::GetMap(#LeafletGadget)
  
  ; create a tilelayer
  
  Protected tileLayer
  
  tileLayer= Leaflet::NewTileLayer(Leaflet::#TileLayerType_GoogleMapHybrid)
  ; tileLayer = Leaflet::NewTileLayer(Leaflet::#TileLayerType_GoogleMapRoadmap)
  ; tileLayer = Leaflet::NewTileLayer(Leaflet::#TileLayerType_GoogleMapSatellite)
  ; tileLayer = Leaflet::NewTileLayer(Leaflet::#TileLayerType_GoogleMapTerrain)
  
  Leaflet::AddItem(myMap, tileLayer)
  
  ; adjust the zoom
  Leaflet::SetAttribute(myMap, Leaflet::#Zoom, 16)
  
  ; center to a specific position
  Leaflet::PanTo(myMap, Leaflet::LatLng(  48.486520, 7.693640  ) )
  
  
EndProcedure

Leaflet::Init(@Main())
Post Reply