Skip to content

Add links with integrity to custom projections instead of inline modules which are not recommended #81

@prushforth

Description

@prushforth

Currently, when you set the default projection of a layer to a custom MapML: projection, the preview document contains an inline script like so:

<script type="module">
let customProjectionDefinition = `
{
"projection": "USNATATLAS",
          "origin": [-8046094.80800152, 13563887.19875385],
          "resolutions": [62900.55278081377, 31450.276390406885, 15725.138195203443, 7862.569097601721, 3931.2845488008606, 1965.6422744004303, 982.8211372002152, 491.4105686001076, 245.7052843000538, 122.8526421500269, 61.42632107501345, 30.713160537506724, 15.356580268753362, 7.678290134376681, 3.8391450671883405, 1.9195725335941702, 0.9597862667970851],
          "bounds": [[-8046094.80800152, -2538654.31313448], [8056446.70388680, 13563887.19875385]],
          "tilesize": 256,
          "proj4string" : "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +ellps=sphere +no_defs +type=crs"
}`;
let map = document.querySelector("mapml-viewer");
let cProjection = map.defineCustomProjection(customProjectionDefinition);
map.projection = cProjection;
</script>

This generates a warning in devtools, like this:

image

It should be possible for geoserver to generate that as follows:

<script type="module" integrity="sha384-1/70nM+8Kdg0K81g8Vb5I+/UaWfKy/gd5CiSgsEZsabsdU68XX7tfQi5iMMZGdOp" src="http://example.org/geoserver/web/wicket/bookmarkable/org.geoserver.web.demo.SRSDescriptionPage?10&code=EPSG:2003"></script>

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

    Issue actions