TypeError: L.TileLayer.sygicRestriction is not a function

1.5k Views Asked by At

I'm trying to add a truck restrictions layer to my map using Sygic's Leaflet 1.0.3, and their plugin 1.1.0 with an evaluation key. I'm receiving the following error in the FireFox JavaScript console:

TypeError: L.TileLayer.sygicRestriction is not a function

This makes me think that there's a new version of the plugin, but I don't know the URL since it's not in the documentation.

NOTE: It might be nice to always host the latest like:

https://maps.api.sygic.com/js/leaflet.sygic-latest.js

or just:

https://maps.api.sygic.com/js/leaflet.sygic.js

Here's an excerpt from my code, which is pretty much the same as the example in the online documentation:

<link rel="stylesheet" href="https://maps.api.sygic.com/js/leaflet/1.0.3/leaflet.css">
<link rel="stylesheet" href="https://maps.api.sygic.com/js/sygic/1.2.0/leaflet.sygic.css" />
<script src="https://maps.api.sygic.com/js/leaflet/1.0.3/leaflet.js"></script>

<!-- *** Is there a newer version of the sygic leaflet plugin? ** -->
<script src="https://maps.api.sygic.com/js/leaflet.sygic-1.1.0.js"></script>

...

var map = L.map('mapContainer');
L.TileLayer.sygic('***MY KEY ***',{poi:true,restriction:true}).addTo(map);
L.TileLayer.sygicRestriction('*** MY KEY ****', {categories: ['NoTruck', 'MaxHeight']}).addTo(map);

Any ideas?

1

There are 1 best solutions below

1
On BEST ANSWER

I found the updated plugin URL in the examples posted to GitHub:

<script src="https://maps.api.sygic.com/js/sygic/1.3.0/leaflet.sygic.js"></script>