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);
Does PTV client support the latest version of Leaflet?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)
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,