Page 1 of 1

Display map with PTV xMap client and Leaflet 1.6.0

Posted: Tue Dec 03, 2019 5:10 am
by Prakash
Hello guys,

I want to display an interactive map with the PTV xMap client classes and Leaflet 1.6.0.
But I am unable to do so, facing issues while doing it. Might be xMap client doesn't support Leaflet 1.6.0.

Below is the code:

Code: Select all

<link type="text/css" rel="stylesheet" href="css/leaflet.css"></link>      
<script src="js/leaflet.js"></script>
<script src="js/xmap-client.js"></script>
<script src="js/leaflet.ptv.js"></script>

var map; 
var client = new XMapClient('http://localhost:50010/xmap'); 

//initialize layers
var bgLayer = new L.PtvLayer.Background(client);
var fgLayer = new L.PtvLayer.Foreground(client);
 
//set up the map
//'mapContainer' is the id of the html-element, which we want to show the map in
map = new L.Map('mapContainer', {
    layers: [bgLayer, fgLayer]
}).setView([18.5681213, 73.913795], 2);
I am getting below error:
Uncaught Error: The provided object is not a Layer.
at i.addLayer (leaflet.js:5)
at i._addLayers (leaflet.js:5)
at initialize (leaflet.js:5)
at new i (leaflet.js:5)
Does PTV client support the latest version of Leaflet?
Could you please help me to understand the issue and how I can display a map with PTV xMap client classes and leaflet 1.6.0.

Thanks in advance,

Re: Display map with PTV xMap client and Leaflet 1.6.0

Posted: Tue Dec 03, 2019 8:18 am
by Joost
For xServer 1 we are not actively updating the leaflet library for the latest versions. Our focus is on xMap 2 which has a better interface for connecting to leaflet. Have a look at https://xserver.ptvgroup.com/forum/view ... =612#p2146 for comment from our developer.