Display map with PTV xMap client and Leaflet 1.6.0

This forum covers all questions dealing with visualization of data within the native PTV xMap interface. Please remember that additional plugins such as AJAX or Leaflet may be handeled in other forums.
Post Reply
Prakash
Posts: 22
Joined: Mon Sep 14, 2015 5:21 am

Display map with PTV xMap client and Leaflet 1.6.0

Post 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,
Prakash Kumar
Developer
Webdirekt India Pvt. Ltd.
Joost
Posts: 307
Joined: Fri Apr 25, 2014 1:46 pm

Re: Display map with PTV xMap client and Leaflet 1.6.0

Post 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.
Joost Claessen
Senior Technical Consultant
PTV Benelux
Post Reply