-
Notifications
You must be signed in to change notification settings - Fork 7
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
[GEOS-11232] Add Zoom scaled layer templates to MapML #356
[GEOS-11232] Add Zoom scaled layer templates to MapML #356
Conversation
3821ee8
to
b8444b2
Compare
Hi Joe, could you help me out to evaluate this PR: I tried to create an SLD that would limit the scales at which the states layer will render in CBMTILE: <?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Limits the scale from 1:2 to whatever, but a bug in GS made this kind of style not generate any kml -->
<NamedLayer>
<Name>states_test</Name>
<UserStyle>
<Title>Test of Zoom Scales for MapML</Title>
<Abstract>A sample style that draws a polygon</Abstract>
<FeatureTypeStyle>
<Rule>
<MinScaleDenominator>40000</MinScaleDenominator><!-- max zoom should be 15 -->
<MaxScaleDenominator>80000000</MaxScaleDenominator><!-- min zoom should be 2 -->
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#AAAAAA</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor> I based my scale calculations on the m/px resolutions of CBMTILE: <MinScaleDenominator>40000</MinScaleDenominator><!-- max zoom should be 15 -->
<MaxScaleDenominator>80000000</MaxScaleDenominator><!-- min zoom should be 2 --> In the capabilities I think it has applied the sld rule: <Layer queryable="1" opaque="0">
<Name>topp:states</Name>
<Title>USA Population</Title>
<Abstract>This is some census data on the states.</Abstract>
<KeywordList>
<Keyword>census</Keyword>
<Keyword>united</Keyword>
<Keyword>boundaries</Keyword>
<Keyword>state</Keyword>
<Keyword>states</Keyword>
</KeywordList>
<CRS>EPSG:3978</CRS>
<CRS>CRS:84</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-124.731422</westBoundLongitude>
<eastBoundLongitude>-66.969849</eastBoundLongitude>
<southBoundLatitude>24.955967</southBoundLatitude>
<northBoundLatitude>49.371735</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="-124.731422" miny="24.955967" maxx="-66.969849" maxy="49.371735"/>
<BoundingBox CRS="EPSG:3978" minx="-3385113.991161208" miny="-2857719.8337224196" maxx="3204541.0636327886" maxy="536137.7045786483"/>
<Style>
<Name>states_test</Name>
<Title>Test of Zoom Scales for MapML</Title>
<Abstract>A sample style that draws a polygon</Abstract>
<LegendURL width="20" height="20">
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=topp%3Astates"/>
</LegendURL>
</Style>
<MinScaleDenominator>40000.0</MinScaleDenominator>
<MaxScaleDenominator>8.0E7</MaxScaleDenominator>
</Layer> However when I do a getmap, I get When I change the MapML extension to"Use Tiles", the |
Peter,
I was assuming that the TiledCRS scales were the same as the SLD scales -
did not realize they were inverse ground resolutions. The latest push
contains a fix to convert and compare them properly.
Thanks,
Joe
…On Fri, Jan 26, 2024 at 4:35 PM Peter Rushforth ***@***.***> wrote:
Hi Joe, could you help me out to evaluate this PR:
I tried to create an SLD that would limit the scales at which the states
layer will render in CBMTILE:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Limits the scale from 1:2 to whatever, but a bug in GS made this kind of style not generate any kml -->
<NamedLayer>
<Name>states_test</Name>
<UserStyle>
<Title>Test of Zoom Scales for MapML</Title>
<Abstract>A sample style that draws a polygon</Abstract>
<FeatureTypeStyle>
<Rule>
<MinScaleDenominator>40000</MinScaleDenominator><!-- max zoom should be 15 -->
<MaxScaleDenominator>80000000</MaxScaleDenominator><!-- min zoom should be 2 -->
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#AAAAAA</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
I based my scale calculations on the m/px resolutions of CBMTILE:
<MinScaleDenominator>40000</MinScaleDenominator><!-- max zoom should be 15 -->
<MaxScaleDenominator>80000000</MaxScaleDenominator><!-- min zoom should be 2 -->
In the capabilities I think it has applied the sld rule:
<Layer queryable="1" opaque="0">
<Name>topp:states</Name>
<Title>USA Population</Title>
<Abstract>This is some census data on the states.</Abstract>
<KeywordList>
<Keyword>census</Keyword>
<Keyword>united</Keyword>
<Keyword>boundaries</Keyword>
<Keyword>state</Keyword>
<Keyword>states</Keyword>
</KeywordList>
<CRS>EPSG:3978</CRS>
<CRS>CRS:84</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-124.731422</westBoundLongitude>
<eastBoundLongitude>-66.969849</eastBoundLongitude>
<southBoundLatitude>24.955967</southBoundLatitude>
<northBoundLatitude>49.371735</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="-124.731422" miny="24.955967" maxx="-66.969849" maxy="49.371735"/>
<BoundingBox CRS="EPSG:3978" minx="-3385113.991161208" miny="-2857719.8337224196" maxx="3204541.0636327886" maxy="536137.7045786483"/>
<Style>
<Name>states_test</Name>
<Title>Test of Zoom Scales for MapML</Title>
<Abstract>A sample style that draws a polygon</Abstract>
<LegendURL width="20" height="20">
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image%2Fpng&width=20&height=20&layer=topp%3Astates"/>
</LegendURL>
</Style>
<MinScaleDenominator>40000.0</MinScaleDenominator>
<MaxScaleDenominator>8.0E7</MaxScaleDenominator>
</Layer>
However when I do a getmap
<http://localhost:8080/geoserver/topp/wms?service=WMS&version=1.3.0&request=GetMap&layers=topp%3Astates&bbox=-3385113.991161208%2C-2857719.8337224196%2C3204541.0636327886%2C536137.7045786483&width=768&height=395&srs=EPSG%3A3978&styles=states_test&format=text/html;%20subtype=mapml>,
I get <map-input name="z" type="zoom" value="25" min="25"
max="25"></map-input>.
—
Reply to this email directly, view it on GitHub
<#356 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHRJZ4VX4VFQFIXWHOS3M7TYQQOQXAVCNFSM6AAAAABCK4BALGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJSG4ZDMNJZGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just one comment as I've found one bit confusing.
public Integer getMinZoomForDenominator(double denominator) { | ||
// handles the case where denominator is larger than the largest scale or is infinity | ||
if (denominator == Double.POSITIVE_INFINITY | ||
|| denominator >= convertGroundResolutionToScale(scales[0])) return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call is confusing, convert a ground resolution to scale, and you pass a scale...
Checking the WGS84 initialization inside TiledCRSConstants, I can see where the issue is... it defines scale as the inverse of the pixel size in ground units, but an actual scale is using the expression you have in convertGroundResolutionToScale method.
Checking actual use, it seems the "scales" are not used (not even by the GWC integration, where there is a separate resolutions array), other than checking the length of the array.
@prushforth can we clarify the code? We can either stop calling them scales, and calling them resolutions instead (and avoid the "1/res" math, just use the resolution directly instead)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prushforth can we clarify the code? We can either stop calling them scales, and calling them resolutions instead (and avoid the "1/res" math, just use the resolution directly instead)?
yes, it would be better to use resolutions directly, but it may involve breakage / refactoring
Checking actual use, it seems the "scales" are not used
good, hopefully that makes it straightforward tbd.
The actual numbers are duplicated, which is not good, in the MapMLGridSets.java class, where they are used in resolutions.
Sorry for the confusion.
Edit: I recall that there is a bit of code that calculates the zoom to be used for the preview map based on the fit of the bounds into a pre-defined viewport of 1024 x 768. I believe it must use the scales/resolutions to determine the correct zoom value.
@turingtestfail I think the system may not be generating the bounds correctly. The It's just a guess, but I think the bounds are messed up by the |
…ver#7316) * [GEOS-11225] AuthKey synchronize the user/group automatically * - Purge web-service cache on synchronize - Code refactoring for readability and stability * - missing mapper setting * - trying to fix qa checks * Fix QA checks * - Updating the plugin user documentation * - docs typo
@turingtestfail regarding bounds, you might want to have a look at what I'm doing with bounds reprojection in the TCRS PR (each projection gets a bbox in its own CRS, before it was using the same bbox as the request, untransformed) |
Thanks @aaime , In incorporated your bounds reprojection into this PR |
@prushforth how are we looking on this one? Can it be turned into an official PR? |
I was having problems working across PRs because my data directory got used to the CRS PR while this PR doesn't have that stuff in it yet. Progress on so many fronts is foreign to me :-P. Anyway, I believe there's still an issue when a layer has "Use Tiles" checked, the generated When I load the preview for the states layer with zoom scaling set up, but "Use Tiles" is not checked: <map-extent units="CBMTILE" checked="checked" hidden="hidden">
<map-input name="z" type="zoom" value="15" min="2" max="15"></map-input><!-- value is not used in this case -->
<map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-3385113.991161208" max="3204541.0636327886"></map-input><!-- min / max are pcrs coords. Good! -->
<map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="-2857719.8337224196" max="536137.7045786483"></map-input>
<map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-3385113.991161208" max="3204541.0636327886"></map-input>
<map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="-2857719.8337224196" max="536137.7045786483"></map-input>
<map-input name="w" type="width" min="1" max="10000"></map-input>
<map-input name="h" type="height" min="1" max="10000"></map-input>
<map-link tref="http://localhost:8080/geoserver/wms?request=GetMap&crs=urn:x-ogc:def:crs:EPSG:3978&service=WMS&bbox={xmin},{ymin},{xmax},{ymax}&layers=states&format=image/png&width={w}&styles=&language=en&version=1.3.0&transparent=true&height={h}" rel="image"></map-link>
<map-input name="i" type="location" axis="i" units="map"></map-input>
<map-input name="j" type="location" axis="j" units="map"></map-input>
<map-link tref="http://localhost:8080/geoserver/wms?request=GetFeatureInfo&query_layers=states&crs=urn:x-ogc:def:crs:EPSG:3978&bbox={xmin},{ymin},{xmax},{ymax}&language=en&version=1.3.0&transparent=true&service=WMS&layers=states&width={w}&x={i}&feature_count=50&y={j}&styles=&info_format=text/mapml&height={h}" rel="query"></map-link>
</map-extent> When I select "Use Tiles" for the layer (and set up tile caching so it goes through WMTS): <map-extent units="CBMTILE" checked="checked" hidden="hidden">
<map-input name="z" type="zoom" value="15" min="2" max="15"></map-input><!-- value is used to tell what the -->
<!-- min/max values in the location -->
<!-- inputs below mean/ where they are -->
<map-input name="x" type="location" axis="column" units="tilematrix" min="1846690" max="2235842"></map-input>
<map-input name="y" type="location" axis="row" units="tilematrix" min="2289790" max="2490214"></map-input>
<map-link tref="http://localhost:8080/geoserver/gwc/service/wmts?request=GetTile&tilematrixset=CBMTILE&tilematrix={z}&TileRow={y}&service=WMTS&format=image/png&style=&TileCol={x}&version=1.0.0&layer=topp:states" 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="http://localhost:8080/geoserver/gwc/service/wmts?request=GetFeatureInfo&format=image/png&i={i}&j={j}&TileCol={x}&version=1.0.0&layer=topp:states&tilematrixset=CBMTILE&tilematrix={z}&TileRow={y}&service=WMTS&infoformat=text/mapml&feature_count=50&style=" rel="query"></map-link>
</map-extent> On main, if I set up the states layer to use tiles and the tile cache, it comes out like this (note that the min/max tilematrix coordinates are the same as in the previous example, except the <map-extent units="CBMTILE" checked="checked" hidden="hidden">
<map-input name="z" type="zoom" value="25" min="0" max="25"></map-input>
<map-input name="x" type="location" axis="column" units="tilematrix" min="1846690" max="2235842"></map-input>
<map-input name="y" type="location" axis="row" units="tilematrix" min="2289790" max="2490214"></map-input>
<map-link tref="http://localhost:8080/geoserver/gwc/service/wmts?request=GetTile&tilematrixset=CBMTILE&tilematrix={z}&TileRow={y}&service=WMTS&format=image/png&style=&TileCol={x}&version=1.0.0&layer=topp:states" 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="http://localhost:8080/geoserver/gwc/service/wmts?request=GetFeatureInfo&format=image/png&i={i}&j={j}&TileCol={x}&version=1.0.0&layer=topp:states&tilematrixset=CBMTILE&tilematrix={z}&TileRow={y}&service=WMTS&infoformat=text/mapml&feature_count=50&style=" rel="query"></map-link>
</map-extent> So I think we're pretty close. |
@prushforth Looking at the code that sets the axis column and row maxes, it appears that they are always set using the max zoom level specified in the array that comes back from WMTS - for example:
I believe that is the reason that the "z" "value" is set to the max zoom level. Is that the correct approach to take? |
Whatever the z value used to set the input.setMax is should be set in the <map-input type="zoom" value="${minMax.length - 1}"> that is probably set a little bit earlier. As I mentioned, it doesn't need to be within the zoom range established by the min/maxScaleDenominator calculation, it just needs to be the correct array index that can be used to deduce the bounds from those tile row/col min/max values. |
I updated the code with what might be workable, tbd. I will look at a test tomorrow. Revert if you've got something cooking that's better. |
I was looking at using the style based maximum to compute the x and y, but looking again at your notes, if these extents are based on the tileset maximums then what you have pushed makes the most sense. |
Yes the higher the zoom level the better the bounds I think. Updating the already-added extentZoomInput seems a little risky, but it seems to work. That's an advantage of jaxb at least. |
…rver#7358) * Bump com.jayway.jsonpath:json-path from 2.7.0 to 2.9.0 in /src Bumps [com.jayway.jsonpath:json-path](https://github.com/jayway/JsonPath) from 2.7.0 to 2.9.0. - [Release notes](https://github.com/jayway/JsonPath/releases) - [Changelog](https://github.com/json-path/JsonPath/blob/master/changelog.md) - [Commits](json-path/JsonPath@json-path-2.7.0...json-path-2.9.0) --- updated-dependencies: - dependency-name: com.jayway.jsonpath:json-path dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> * Add scoped override for json-smart to override the runtime scope of the json-path provided version --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mark <[email protected]>
[GEOS-11290] With Oauth enabled, anon users get random auth requests
…ver#7353) * [GEOS-11263] Fix hideEmptyRules in JSON Legends * Compute hideEmptyRules with BBOX only and skip rasterSymbolizers * Better test
Bumps [org.springframework:spring-expression](https://github.com/spring-projects/spring-framework) from 3.2.5.RELEASE to 5.2.23.RELEASE. - [Release notes](https://github.com/spring-projects/spring-framework/releases) - [Commits](spring-projects/spring-framework@v3.2.5.RELEASE...v5.2.23.RELEASE) --- updated-dependencies: - dependency-name: org.springframework:spring-expression dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
@prushforth time to turn this one into an official PR? |
…dule (geoserver#7363) * Use threads to read altitude in wps-longitudinal-profile community module * Adding GeoServer copyright header to AltitudeReaderThread * Adding GeoServer copyright header to ProfileVertice * Replace Vector with ArrayList * Move thread pool to class level * Replace Stack with ArrayList * Retrieve adjustment geoms only once at start * Process altitude adjustment by adjustable chunks of vertices * QA fixes
Yes please. |
switched to binary search working test for zoom input unit tests and fix for single extent detection GetMap tests wms output format documentation added some edge tests unused var ground resolution to scale updated tests and fixed infinite check Reproject bounds - For gwc-backed GetMap request update extentZoomInput.value with the gss.getZoomStop() to match the zoom value used by the location inputs' min/max row and column axes. Non-GWC backed GetMap zoom input will not carry a value attribute, and it's not necessary - tbd: a test to cover it
7107c21
to
d864c79
Compare
Checklist
main
branch (backports managed later; ignore for branch specific issues).For core and extension modules:
[GEOS-XYZWV] Title of the Jira ticket
.