melowntech / vts-mapproxy

VTS Mapproxy
BSD 2-Clause "Simplified" License
30 stars 5 forks source link

configure TMS service to multiple sub domains #19

Closed jrjdavidson closed 2 years ago

jrjdavidson commented 2 years ago

Is there a way to configure a domain to multiple subdomains in the resources e.g. : "http://tiles-{a-d}.data-cdn.linz.govt.nz[...]"

vaclavblazek commented 2 years ago

What type of resource? tms-raster via GDAL's WMTS?

jrjdavidson commented 2 years ago

tms-raster Here is the snippet from my resources.json file- the tileRange and lodRange are pure guesses, I haven't figured out how to obtain that info (is there a mapproxy-calipers equivalent for remote datasets?) :

{
        "comment": "lds NZ hillshade",
        "group": "linz",
        "id": "lds-hillshadetest5",
        "type": "tms",
        "driver": "tms-raster-remote",
        "credits": ["linz"],
        "definition": {
            "remoteUrl": "https://tiles-a.data-cdn.linz.govt.nz/services;key=###editedout###/tiles/v4/layer=50765/EPSG:3857/{loclod}/{locx}/{locy}.png"

        },
        "registry": {
            "credits" : {"linz":{ "id": 99, "notice": "<a href=http://data.linz.govt.nz target=_blank>Sourced from LINZ. CC BY 4.0</a>" }}
        },
        "referenceFrames":{
            "melown2015": {
                "tileRange": [[0, 0 ],[0, 0 ]],
                "lodRange": [1,23]
            },
            "webmerc-projected": {
                "tileRange": [[0, 0 ],[1, 1 ]],
                "lodRange": [1,23]
            }

        }
    }
vaclavblazek commented 2 years ago

Aha, so it's tms-raster-remote. Here it comes: "remoteUrl": "https://tiles-/{alt(a,b,c,d)}.data-cdn.linz.govt.nz/... (see https://github.com/melowntech/vts-mapproxy/blob/master/docs/resources.md#url-templates for details)

Re calipers: Calipers tool is only for geo (GDAL) datasets. There is no way how to know what tile ranges the remote site provides. It's up to you to know that these tiles are compatible with given reference frame and hand craft tile/lod ranges.

BTW, the difference between webmerc-projected and melown2015 is exactly 1 LOD, so melown2015 lodRange.min should be webmerc-projected lodRange.min + 1.

jrjdavidson commented 2 years ago

Thanks!

"remoteUrl": "https://tiles-{alt(a,b,c,d).data-cdn.linz.govt.nz/...

is there a typo, missing the } ?

Gotcha for the range. I'm sure there is a way to get that information from the LINZ documentation, just haven't come across it yet. No harm in putting the lodRange really high is there?

vaclavblazek commented 2 years ago

Re }: Yes, typo, fixed. Thx.

The only harm is that if you have deep enough surface you may to start to reference non-existent images. Otherwise not.

jrjdavidson commented 2 years ago

I think there is an extra slash in there too I used https://tiles-{alt(a,b,c,d)}.data-cdn.linz.govt.nz/.... Thanks for your help, seems to work fine.

For the lodRange - is there any way to get the range easily by reading the getCapabilities xml file? There seems to be a range from 0-21 in the corresponding tileMatrixSet, but not sure how enure how it corresponds to the lodRange (and tileRange) for the melown2015 referenceFrame

vaclavblazek commented 2 years ago

The webmerc subtree in melown2015 starts at 1-0-0, so tile 0-0-0 from remote server is mapped to tile 1-0-0 in melown2015 => you have to shift lodRange by one, i.e. 0-21 -> 1-22. The loclod etc. expansion variables use tile indices (lod/x/y) relative to subtree root.

Yes, another typo, thx.