cga-harvard / Hypermap-Registry

Hypermap Registry, remote map services made easy for your SDI
https://cga-harvard.github.io/Hypermap-Registry/
MIT License
38 stars 21 forks source link

Harvest and use scale dependency information for services #241

Open blewis opened 7 years ago

blewis commented 7 years ago

Use in determination of validity (map might not display at global scale but will display at zoomed-in scale) and to message user regarding view scale.

capooti commented 7 years ago

@bglewis do OGC service metadata in GetCapabilities provide such an information? /cc @tomkralidis

blewis commented 7 years ago

I think scale dependency info is optional in WMS. If it is present we should use it. For service registries there is a need to handle this address the situation when neither valid default map extent nor scale dependency information is not provided. This is a huge unsolved problem for service sharing. Automated approaches are difficult but an admin tool / crowd-source tool that lets users set both scale dependencies and default map extent for remote services would be very useful.

tomkralidis commented 7 years ago

WMS 1.3.0 provides optional Layer MinScaleDenominator and MinScaleDenominator elements; the WMS 1.1.1 equivalent being ScaleHint@min/@max. This should be supported in OWSLib proper which you can use to satisfy this use case.

capooti commented 7 years ago

It would be interesting to figure out how many services/layers expose this before adding this to django models

tomkralidis commented 7 years ago

@capooti: something like the below may help in the analysis:

from hypermap.aggregator.utils import get_wms_version_negotiate

num_services = 0
num_services_with_scale = 0
num_layers = 0
num_layers_with_scale = 0

wms_urls = ['http://geo.woudc.org/ows']

for wms_url in wms_urls:
    scalehint_found = False
    wms = get_wms_version_negotiate(wms_url)
    num_services += 1
    num_layers += len(wms.contents.keys())

    for layer in wms.contents:
        if wms.contents[layer].scaleHint is not None:
            scalehint_found = True
            num_layers_with_scale += 1
    if scalehint_found:
        num_services_with_scale += 1

print('Number of services: {}'.format(num_services))
print('Number of layers: {}'.format(num_layers))
print('Number of services implementing scale hint: {}'.format(
    num_services_with_scale))
print('Number of layers implementing scale hint: {}'.format(
    num_layers_with_scale))
capooti commented 7 years ago

Thanks, I was exactly thinking to something like this. Let me try this on our WMS list to figure out what is the % of services which are exposing scales /cc @bglewis