-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property '_leaflet_id' of undefined #6
Comments
if I could get in your source code something that could jon read this way: {
"name": "LandMap",
"type": "tileLayer",
"url": "http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png",
"active": false,
"options":{}
} And not this: {
"name": "Open Cycle Map",
"layer": {
"type": "tileLayer",
"args": [
"http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"
]
}
} having url and type outside layer and url instead of args @stefanocudini Your code: _instanceLayer: function(layerDef) {
if(layerDef instanceof L.Class)
return layerDef;
else if(layerDef.type && layerDef.url)
return this._getPath(L, layerDef.type).apply(window, layerDef.url);
},
_addLayer: function (layer, overlay, group) {
var layerLayer = this._instanceLayer(layer.layer),
id = L.stamp(layerLayer);
if(layer.active)
this._layersActives.push(layerLayer);
this._layers[id] = {
layer: layerLayer,
name: layer.name,
icon: layer.icon,
overlay: overlay,
group: group
};
if (this.options.autoZIndex && layerLayer.setZIndex) {
this._lastZIndex++;
layerLayer.setZIndex(this._lastZIndex);
}
}, |
the format configuration of the plugin can not 'be changed to your specific use case... For example: var baseLayers = [],
yourlayers = yourConfig.layers.baselayers,
for(var i in yourlayers)
{
baseLayers.push({
"active": yourlayers[i].active,
"name": yourlayers[i].name,
"type": yourlayers[i].type,
"layer": {
"type": "tileLayer",
"args": [
yourlayers[i].url
]
}
});
}
map.addControl( new L.Control.PanelLayers(baseLayers) ); |
hank you, it works for tileLayer layers but not others like IGN. |
what is IGN layer? what's leaflet class use for create this layer? in the filed layer.type = "tileLayer" you can use any leaflet class to create any layer type. for example "geoJson" , "featureGroup" and other created from you. |
it's something like that: {
"name": "IGN ",
"type": "ign",
"layer":"GEOGRAPHICALGRIDSYSTEMS.MAPS",
"key":"mykeys",
"url": "https://gpp3-wxs.ign.fr/' + layerdata.key + '/geoportail/wmts?LAYER='+layerdata.layer+'&EXCEPTIONS=text/xml&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}",
"active": false,
"options":{}
} https://github.com/mylen/leaflet.TileLayer.WMTS |
Hi,
I would like to put your plugin into my project with GeoJSON already in place in my database. I already also a json configuration for my layers like:
There must be corresponding to your plugin to make it work.
Thank you, Sorry for my english, I'm french.
The text was updated successfully, but these errors were encountered: