backdrop-contrib / leaflet

Backdrop CMS Integration with the Leaflet map scripting library.
https://backdropcms.org/project/leaflet
GNU General Public License v2.0
2 stars 2 forks source link

Adding WMS support and and handling overlays #53

Closed AlexHoebart-ICPDR closed 6 months ago

AlexHoebart-ICPDR commented 6 months ago

Thank you very much for porting and maintaining this module! I'm using it on one of our websites, e.g. here: https://www.danubehis.org/latest-results/h

We added several optional overlays from our Web Map Service (WMS) which can be enabled in the layer switcher. For the overlays to work I needed to do only two small changes in the code and add WMS support as already available as patch for Drupal 7: https://www.drupal.org/project/leaflet/issues/2392651#comment-11007467

I will post a PR for review as I think it might be useful for others as well.

AlexHoebart-ICPDR commented 6 months ago

For testing the PR, the following custom map code could be used in the hook_leaflet_map_info():

$layers = array( 'DanubeGIS' => array( 'label' => 'DanubeGIS', 'description' => t('DanubeGIS base layers'), 'layers' => array( 'Danube River Basin District' => array( 'urlTemplate' => 'https://www.danubegis.org/geoserver/wms?service=WMS', 'type' => 'wms', 'options' => array( 'layers' => 'DRBMP2021:DRBD_2021', 'styles' => 'DRBD_light', 'attribution' => 'ICPDR (http://www.icpdr.org)', 'transparent' => 'true', 'format' => 'image/png', ), 'layer_type' => 'overlay', 'enabled' => true, ), 'Surface Waters' => array( 'urlTemplate' => 'https://www.danubegis.org/geoserver/ows?', 'type' => 'wms', 'options' => array( 'layers' => 'DRBMP2021:River4000,DRBMP2021:LWBody100,DRBMP2021:TWBody,DRBMP2021:CWBody', 'styles' => 'Danube_River4000_Labels,Lakes,TWBody,CWBody', 'attribution' => 'ICPDR (http://www.icpdr.org)', 'transparent' => 'true', 'format' => 'image/png', ), 'layer_type' => 'overlay', / 'enabled' => false, ), ), ), );

indigoxela commented 6 months ago

Hi @AlexHoebart-ICPDR, nice to see you again in this queue. :wink:

I have to admit, I've never heard of WMS before. :see_no_evil: The change looks small, though and (besides some formal thingies) interesting.

Will try to have a closer look this weekend.

indigoxela commented 6 months ago

Nice! Had a play today, and WMS is really something to support in this module. :wink:

I merged the PR and take care of the "formal thingies".

AlexHoebart-ICPDR commented 6 months ago

Thanks for your support!