Skip to content

Re-enable simplification distance support in MapML - #385

Closed
aaime wants to merge 8 commits into
geosolutions-it:mainfrom
aaime:mapml_simplification
Closed

aaime wants to merge 8 commits into
geosolutions-it:mainfrom
aaime:mapml_simplification

Conversation

@aaime

@aaime aaime commented May 22, 2025

Copy link
Copy Markdown
Member

The simplification distance is no longer being passed down into the Query due to a refactor happened back in January. Re-enabling it.

@prushforth before I work on a test can you double check the pre-generalized it working for you now, or if it still needs some attention?

Checklist

For core and extension modules:

  • New unit tests have been added covering the changes.
  • Documentation has been updated (if change is visible to end users).
  • The REST API docs have been updated (when changing configuration objects or the REST controllers).
  • There is an issue in the GeoServer Jira (except for changes that do not affect administrators or end users in any way).
  • Commit message(s) must be in the form [GEOS-XYZWV] Title of the Jira ticket.
  • Bug fixes and small new features are presented as a single commit.
  • Each commit has a single objective (if there are multiple commits, each has a separate JIRA ticket describing its goal).

The PR will be merged when all the build checks are green (see automated QA checks), there is a code committer review, and the checklist has been fulfilled.

@prushforth

prushforth commented May 23, 2025

Copy link
Copy Markdown

Hi Andrea, with this PR built and installed, the hint distance for mapmlusefeatures:true with the preview link of my test layer is initially:

22 May 20:47:19 DEBUG  [data.gen] - Hint geometry distance: 753.7031107406133
22 May 20:47:19 INFO   [gen.DSFinderRepository] - Not in Geoserver catalog: file:data/canada/4/canada.shp
22 May 20:47:19 DEBUG  [data.gen] - Hint geometry distance: 753.7031107406133
22 May 20:47:19 INFO   [data.gen] - Using generalizsation: file:data/canada/4/canada.shp canada the_geom 380.0

with mapmlusefeatures:false on the same request, it's about 8x larger.

FWIW I don't think the feature simplification distance should be or is the same as the distance hint for the pregen module, because those features are already generalized and have topology preserved (maybe, but if not that's not our problem).

22 May 20:48:07 DEBUG  [data.util] - CRSConverter: Converting object of class java.lang.String to org.geotools.api.referencing.crs.CoordinateReferenceSystem
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation  only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation  only.
22 May 20:48:07 DEBUG  [renderer.lite] - Computed scale denominator: 2.8348270982256256E7
22 May 20:48:07 DEBUG  [renderer.lite] - creating rules for scale denominator - 28,348,270.982
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [data.util] - CRSConverterFactory can be applied from Strings to CRS  only.
22 May 20:48:07 DEBUG  [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
22 May 20:48:07 DEBUG  [renderer.lite] - Processing 1 stylers for https://mapml.geo.ca/:Canada
22 May 20:48:07 DEBUG  [renderer.lite] - Expanding rendering area by 2 pixels to consider stroke width
22 May 20:48:07 DEBUG  [renderer.lite] - Querying layer https://mapml.geo.ca/:Canada with bbox: ReferencedEnvelope[-7326932.842265683 : 7944847.701295408, -2100020.320040646 : 5162806.705613407] DefaultProjectedCRS[EPSG:NAD83 / Canada Atlas Lambert] AXIS["Easting", EAST] AXIS["Northing", NORTH]
22 May 20:48:07 DEBUG  [renderer.crs] - Failed to intersect the geometry with the projection area of validity mask, trying a precision reduction approach with a precision of 0.001
22 May 20:48:07 DEBUG  [renderer.crs] - Failed to intersect the geometry with the projection area of validity mask, trying a precision reduction approach with a precision of 0.01
22 May 20:48:07 DEBUG  [renderer.crs] - Failed to intersect the geometry with the projection area of validity mask, trying a precision reduction approach with a precision of 0.1
22 May 20:48:07 DEBUG  [renderer.crs] - Failed to intersect the geometry with the projection area of validity mask, trying a precision reduction approach with a precision of 1.0
22 May 20:48:07 DEBUG  [renderer.crs] - Failed to intersect the geometry with the projection area of validity mask, trying a precision reduction approach with a precision of 10.0
22 May 20:48:07 DEBUG  [renderer.crs] - Failed to intersect the geometry with the projection area of validity mask, trying a precision reduction approach with a precision of 100.0
22 May 20:48:07 WARN   [renderer.crs] - Failed to intersect the geometry with the projection area of validity mask, returning the original geometry: POLYGON ((-7326932.842265683 -2100020.320040646, -7326932.842265683 5162806.705613407, 7944847.701295408 5162806.705613407, 7944847.701295408 -2100020.320040646, -7326932.842265683 -2100020.320040646))
22 May 20:48:07 DEBUG  [data.gen] - Hint geometry distance: 6029.6248859241605
22 May 20:48:07 INFO   [gen.DSFinderRepository] - Not in Geoserver catalog: file:data/canada/5/canada.shp
22 May 20:48:07 DEBUG  [data.gen] - Hint geometry distance: 6029.6248859241605
22 May 20:48:07 INFO   [data.gen] - Using generalizsation: file:data/canada/5/canada.shp canada the_geom 2500.0

@aaime

aaime commented May 23, 2025

Copy link
Copy Markdown
Member Author

Does not match what I see locally. Can you share your setup? Data and data directory?

In the meantime please prioritize reviewing #384

@prushforth

Copy link
Copy Markdown

Does not match what I see locally. Can you share your setup? Data and data directory?

I put the contents of this zip file into ${GEOSERVER_DATA_DIR}/data/canada. I add a pregen data source per this picture:

image

  • publish the layer defined by the data source
  • set the layer up as MapML:CBMTILE
  • change to GEOTOOLS_DEVELOPER_LOGGING
  • load the preview for the Canada layer

In the meantime please prioritize reviewing #384

I'll review it starting today.

@aaime

aaime commented Jun 5, 2025

Copy link
Copy Markdown
Member Author

@prushforth check out the new commit, it aligns the pixel simplification distance to the streaming renderer, that accounts exactly for a 8x difference. Mind, I would check rendering of complex linework to see if it still renders properly, the Java Graphics2D uses heavier antialiasing, it results in thicker lines, which in turns hides tiny misalignment, the leafleft client side rendering paints thinner lines, they might become visible. Some tuning of the value might be in order.

@aaime

aaime commented Jun 5, 2025

Copy link
Copy Markdown
Member Author

Also a note, to build this you'll need fresh jars for GeoTools, API breaking changes are occurring in some modules as we prepare to ditch JAI and replace it with ImageN.

@prushforth

Copy link
Copy Markdown

Just saw this now. will check it out, thanks!

@prushforth

Copy link
Copy Markdown

The hints calculated and used match much better the equivalent from the raster experience now!! Thanks, great work!

@aaime
aaime force-pushed the mapml_simplification branch from 304a5dd to c498e62 Compare June 10, 2025 13:59
@aaime aaime closed this Jun 10, 2025
@aaime
aaime deleted the mapml_simplification branch June 10, 2025 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants