Repository navigation
Skip centerline for polygons too simple to compute - #7560
Closed
loom-agent wants to merge 1 commit into
Closed
loom-agent wants to merge 1 commit into
loom-agent wants to merge 1 commit into
Conversation
msGEOSCenterline() aborted the entire map draw with a GEOS error when a polygon was too simple (e.g. convex or with few vertices) to produce a Voronoi-based centerline. Following the maintainer direction in #7058, skip the centerline for such features instead of throwing: return the already-empty line shape, which downstream callers and renderers handle via their existing numlines == 0 early-returns (msDrawShape, msDrawLineSymbol), and emit a debug message pointing at densify(). Input-validation failures (non-polygon input, negative densify tolerance) stay hard errors. Adds centerline6, a self-contained reproduction from the issue, and flips the existing centerline3 case from an expected exception to a rendered image.
Contributor
|
Closing. Too chatty PR text. See https://mapserver.org/community/ai_tool_policy.html |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request was prepared autonomously by Loom Agent, an AI agent under
human supervision; feedback is welcome and I will address review comments promptly.
Closes #7058.
Problem.
GEOMTRANSFORM (centerline([shape]))on a polygon that is too simple tosupport a Voronoi centerline (e.g. a convex polygon, or one with few vertices) raised
msGEOSCenterline(): Centerline generation failed, try densifying the shapes.andaborted the entire map image rather than just omitting that one feature's centerline.
Root cause. In
msGEOSCenterline()(src/mapgeos.c), the "no Voronoi nodes" case(
nodes.numpoints == 0) and the "no path" case (!path) both calledmsSetError()andreturned
NULL, which propagates as a parser error up throughmsGeomTransformShape()/msDrawTransformedShape()and fails the layer draw.Fix. Per the direction Steve floated in #7058 ("Skipping the features, rather than
throwing an error might be best"), these two runtime-generation branches now skip the
centerline for the offending feature: they return the already-allocated empty line
(
shape2, reset at line 1320 then typedMS_SHAPE_LINE) and emit amsDebug()notepointing the user at
densify(). Downstream already handles the empty shape:msDrawShape(mapdraw.c:2375) andmsDrawLineSymbol(maprendering.c:612) bothearly-return on
numlines == 0, so the feature's other styles still draw and the mapcompletes. Input-validation errors (non-polygon input, negative densify tolerance,
exercised by
centerline4/centerline5) are intentionally left as hard errors.This is distinct from the rejected auto-densify PR #7060 (which looped for 10+ minutes on
remote data): it does not fetch or densify anything, it only stops aborting.
Testing. Reproduced MapServer's actual CI environment on the CI reference platform
(
ubuntu:24.04, the base image CI uses, plus the sameubuntugis/ubuntugis-unstablePPAthat
ci/ubuntu/setup.shinstalls, giving GEOS 3.12.2, GDAL 3.11.4, PROJ 9.4.1). BuiltWITH_GEOS=ONclean (exit 0) with CI's exact flags-Wall -Werror -Wextraand CMake-Werror=dev;mapserv -vreportsSUPPORTS=GEOS.--strict_modeis the CI default (AUTOTEST_OPTS?=--strict_modein the Makefile). With it,all 6 centerline tests pass on GEOS 3.12.2, including our changed goldens
centerline3.pngand
centerline6.png: those were generated on GEOS 3.12.1 and still match on 3.12.2, whichconfirms the too-simple polygons render only the base layer (the centerline is skipped, so the
golden is GEOS-version-stable). Reverting
src/mapgeos.cmakescenterline3and the newcenterline6fail withAttributeError: 'NoneType'; restoring passes both. Before the fixcenterline6aborts with the GEOS error and yields no image; after, it renders the square'sfill/outline with no centerline stroke and no exception.
centerline4/centerline5keepfailing exactly as today (validation errors unchanged). The full
miscsuite shows no newfailures vs. clean main (the pre-existing failures are environmental: PostGIS/OGR/cluster
tests that need data CI provisions).
Notes.
centerline3flips from an expected exception to a rendered image, so its_exception.txtis removed and a newcenterline3.pnggolden is included. Both new goldenswere generated on the CI platform (Ubuntu 24.04,
ci/ubuntu/setup.sh).