Skip to content

Add inline/remote MapML for preview / HTML output toggle to MapML Publishing panel, format_options #80

Open
@prushforth

Description

@prushforth
Member

Currently, the text/html; subtype=mapml format (also used by the layer preview link) sends "remote" MapML, i.e. a link to the remote text/mapml document for the layer. It should be possible to request an HTML preview document that contains the layer MapML representation inline, which in may be able to provide a DOM API over that content, which is not likely going to be the case for remote content.

Remote content link:

<html>
    <head>
        <title>Current Conditions</title>
        <meta charset="utf-8">
        <script type="module" src="https://.../geoserver/mapml/viewer/widget/mapml.js"></script>
        <style>...</style>
    </head>
    <body>
        <mapml-viewer projection="CBMTILE" zoom="3" lat="64.88778217676385" lon="-91.29542462849209" controls>
            <map-layer label="Current Conditions"
                src="https://.../geoserver/msc/wms?LAYERS=CURRENT_CONDITIONS&BBOX=-4267682.0%2C-370965.0%2C4622336.0%2C3847163.0&HEIGHT=768&WIDTH=364&SRS=MapML%3ACBMTILE&STYLES=&FORMAT=text%2Fmapml&format_options=mapml-wms-format%3Aimage%2Fpng&SERVICE=WMS&REQUEST=GetMap&VERSION=1.3.0"
                checked></map-layer>
        </mapml-viewer>
    </body>
</html>

Equivalent inline MapML content:

<html>
    <head>
        <title>Current Conditions</title>
        <meta charset="utf-8">
        <script type="module" src="https://.../geoserver/mapml/viewer/widget/mapml.js"></script>
        <style>...</style>
    </head>
    <body>
        <mapml-viewer projection="CBMTILE" zoom="3" lat="64.88778217676385" lon="-91.29542462849209" controls>
            <map-layer label="Current Conditions" checked>
                <map-link rel="license" href="https://eccc-msc.github.io/open-data/licence/readme_en/" title="Environment and Climate Change Canada Data Servers End-use Licence"></map-link>
                <map-link rel="alternate" projection="OSMTILE" href="https://.../geoserver/msc/wms?format_options=mapml-wms-format%3Aimage%2Fpng&request=GetMap&crs=MapML%3AOSMTILE&service=WMS&bbox=-1.9771353430346526E7%2C3550701.251005205%2C2.0000184074674536E7%2C1.8524695031846646E7&format=text%2Fmapml&layers=CURRENT_CONDITIONS&width=364&version=1.3.0&height=768"></map-link>
                <map-link rel="alternate" projection="APSTILE" href="https://.../geoserver/msc/wms?format_options=mapml-wms-format%3Aimage%2Fpng&request=GetMap&crs=MapML%3AAPSTILE&service=WMS&bbox=-5266985.219718212%2C-5266985.219718212%2C9266985.219718212%2C9266985.219718212&format=text%2Fmapml&layers=CURRENT_CONDITIONS&width=364&version=1.3.0&height=768"></map-link>
                <map-link rel="alternate" projection="WGS84" href="https://.../geoserver/msc/wms?format_options=mapml-wms-format%3Aimage%2Fpng&request=GetMap&crs=MapML%3AWGS84&service=WMS&bbox=-177.60908974209215%2C30.366141302758248%2C179.66471039483983%2C83.72878702993546&format=text%2Fmapml&layers=CURRENT_CONDITIONS&width=364&version=1.3.0&height=768"></map-link>
                <map-extent units="CBMTILE" checked hidden>
                    <map-input name="z" type="zoom" min="0" max="25"></map-input>
                    <map-input name="txmin" type="location" rel="tile" position="top-left" axis="easting" units="tilematrix" min="-4267682.0" max="4622336.0"></map-input>
                    <map-input name="tymin" type="location" rel="tile" position="bottom-left" axis="northing" units="tilematrix" min="-370965.0" max="3847163.0"></map-input>
                    <map-input name="txmax" type="location" rel="tile" position="top-right" axis="easting" units="tilematrix" min="-4267682.0" max="4622336.0"></map-input>
                    <map-input name="tymax" type="location" rel="tile" position="top-left" axis="northing" units="tilematrix" min="-370965.0" max="3847163.0"></map-input>
                    <map-link tref="https://geo.weather.gc.ca/geomet?request=GetMap&crs=EPSG:3978&service=WMS&bbox={txmin},{tymin},{txmax},{tymax}&layers=CURRENT_CONDITIONS&format=image/png&width=256&language=en&styles=&version=1.3.0&transparent=true&height=256" rel="tile"></map-link>
                    <map-input name="i" type="location" axis="i" units="tile"></map-input>
                    <map-input name="j" type="location" axis="j" units="tile"></map-input>
                    <map-link tref="https://geo.weather.gc.ca/geomet?request=GetFeatureInfo&query_layers=CURRENT_CONDITIONS&crs=EPSG:3978&bbox={txmin},{tymin},{txmax},{tymax}&language=en&version=1.3.0&transparent=true&service=WMS&layers=CURRENT_CONDITIONS&width=256&x={i}&feature_count=50&y={j}&styles=&info_format=text/plain&height=256" rel="query"></map-link>
                </map-extent>
            </map-layer>
        </mapml-viewer>
    </body>
</html>

Note: I validated that an inline content layer can use the rel="alternate" projecton="..." links to change to a src-based remote content layer. I didn't try with alternate styles, but it's probably the case.

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @prushforth

        Issue actions

          Add inline/remote MapML for preview / HTML output toggle to MapML Publishing panel, format_options · Issue #80 · Maps4HTML/geoserver