bobosch / ods_osm

TYPO3 Extension OpenStreetMap
10 stars 22 forks source link

Add WMS and other base layers for Leaflet #14

Closed dawnbreak closed 1 year ago

dawnbreak commented 9 years ago

I need to add a WMS base layer in Leaflet. For OpenLayers I can add a layer and just put the needed WMS JavaScript in the JavaScript field for the layer like: new OpenLayers.Layer.WMS('###TITLE###', "https://server.example/MapServer/WMSServer", {layers: "0,1"}) When I choose Leaflet in the frontend plugin this is not possible, because it does not include the JavaScript field and requires a tile server, otherwise I even can't select it as a base layer.

What would be your idea how to implement it? Should we just tweak the layer generation for Leaflet to also include the JavaScript like in OpenLayers? Then the code in the layer would be library dependent, or should we extend the layers with a switch and options for the different base layer types?

bobosch commented 9 years ago

I run into the same question with openlayers 3 - every map has a own JS method there.. I think best would be to add a javascript field for every library, e.g. javascript_openlayers, javascript_leaflet and javascript_openlayers3

dawnbreak commented 9 years ago

I don't know yet what will makes most sense. I also haven't looked in OL3 yet how it is there. Any idea how to solve the layer options like attribution, maxZoom, minZoom, etc. which should exist for most libraries or how to merge these with own attributes I might want to set for my layers or just specific to some types? Or do we remove them and put them directly in the JavaScript also for every library?

bobosch commented 9 years ago

Please take a look at the bing layer: new OpenLayers.Layer.Bing({name:\'###TITLE###\',key:\'###STATIC_SCRIPT###\',type:\'Road\'}) I've used markers, the first one is from the FE plugin, the second one from TS You can add maxZoom and minZoom in this database field, because it is a fix value for this entry.

bobosch commented 9 years ago

Can you please checkout my last commit and check if this works for you?

dawnbreak commented 9 years ago

Yes, that will work for me. Is it in purpose that there is no default TypoScript functionality for this static_script replacement?

bobosch commented 9 years ago

No, it was a simple workaround for the google api key ... feel free to implement some better TS integration :-)