Skip to content
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

Add support for WMS maps #5110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ekdahl
Copy link
Contributor

@ekdahl ekdahl commented Jan 31, 2025

Will detect that it is an WMS map by looking for layers in options.

I decided to put all tile layer options in a separate variable because of this:

If any custom options not documented here are used, they will be sent to the WMS server as extra parameters in each request URL.

This means that for example url will be appended as parameter in the request if they are mixed with the tile layer options.

Here are samples of WMTS and WMS maps:

    public function leafletJsTileLayers(): array
    {
        return [
            (object) [
                'default'     => true,
                'label'       => 'WMTS map',
                'url'         => 'https://minkarta.lantmateriet.se/map/topowebbcache?layer=topowebb&tilematrixset=3857&Service=WMTS&Request=GetTile&TileMatrix={z}&TileCol={x}&TileRow={y}',
                'options'  => 
                    (object) [
                        'attribution' => '<a href="https://www.lantmateriet.se">Lantmäteriet</a>',
                        'maxZoom'     => 17,
                        'minZoom'     => 2,
                    ],
            ],
            (object) [
                'label'       => 'WMS map',
                'url'         => 'https://minkarta.lantmateriet.se/map/ortofoto',
                'options'  => 
                    (object) [
                        'attribution' => '<a href="https://www.lantmateriet.se">Lantmäteriet</a>',
                        'layers'      => 'Ortofoto_0.5,Ortofoto_0.4,Ortofoto_0.25,Ortofoto_0.16',
                        'maxZoom'     => 19,
                        'minZoom'     => 2,
                        'service'     => 'WMS',
                    ],
            ],
        ];
    }

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.99%. Comparing base (80e1855) to head (f02d955).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #5110   +/-   ##
=========================================
  Coverage     34.99%   34.99%           
  Complexity    11520    11520           
=========================================
  Files          1189     1189           
  Lines         48502    48502           
=========================================
  Hits          16974    16974           
  Misses        31528    31528           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant