You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The encoding of layers in permalink like layers=B00TTFF is highly unflexible. Almost every change in layers (adding, reordering, ...) break the existing permalinks.
The encoding used on osm.org (i.e. layers=TND) is much better. Every layer has it's unique character and if the character occur in layers character, it means that the layer is enabled.
I solved this problem in my project by overriding the 'createParams' and 'configureLayers' functions:
functioncreateParams(center,zoom,layers){center=center||this.map.getCenter();varparams=OpenLayers.Util.getParameters(this.base);// If there's still no center, map is not initialized yet.// Break out of this function, and simply return the params from the// base link.if(center){//zoomparams.zoom=zoom||this.map.getZoom();//lon,latvarlat=center.lat;varlon=center.lon;if(this.displayProjection){varmapPosition=OpenLayers.Projection.transform({x: lon,y: lat},this.map.getProjectionObject(),this.displayProjection);lon=mapPosition.x;lat=mapPosition.y;}params.lat=Math.round(lat*100000)/100000;params.lon=Math.round(lon*100000)/100000;//layerslayers=layers||this.map.layers;params.layers='_';for(vari=0,len=layers.length;i<len;i++){varlayer=layers[i];if(layer.getVisibility()&&layer.slug){params.layers+=layer.slug}}}returnparams;}
The encoding of layers in permalink like layers=B00TTFF is highly unflexible. Almost every change in layers (adding, reordering, ...) break the existing permalinks.
The encoding used on osm.org (i.e. layers=TND) is much better. Every layer has it's unique character and if the character occur in layers character, it means that the layer is enabled.
I solved this problem in my project by overriding the 'createParams' and 'configureLayers' functions:
But it would be nice, if this is integral part of OpenLayers.
The text was updated successfully, but these errors were encountered: