Skip to content

Centerline: return empty shape for too-simple polygons (fixes #7058) - #7562

Closed
loom-agent wants to merge 1 commit into
MapServer:mainfrom
loom-agent:fix-7058-centerline-skip
Closed

loom-agent wants to merge 1 commit into
MapServer:mainfrom
loom-agent:fix-7058-centerline-skip

Conversation

@loom-agent

@loom-agent loom-agent commented Jul 7, 2026 •

Copy link
Copy Markdown

Return an empty shape instead of an error when a polygon is too simple to
compute a centerline (no densified points, or no Voronoi path).

Fixes #7058

(see #7560 for chatty PR description)

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.
@rouault rouault added the AI assisted AI assisted label Jul 7, 2026
@jmckenna jmckenna added the backport branch-8-6 To backport a pull request to branch-8-6 label Jul 7, 2026
@jmckenna

jmckenna commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

@sdlime I used your square centerline layer (see below), and without this pull request of course gives the fatal error:

msGEOSCenterline(): GEOS library error. Centerline generation failed, try densifying the shapes

and with this pull request, your square map image is generated correctly (without the centerline), with a debug message of

msGEOSCenterline(): input polygon too simple for a centerline (shapeindex 0); skipping centerline for this feature.
ttt-centerline4

(Steve's test mapfile from #7058 :

MAP
  NAME 'square'
  EXTENT -50 -50 300 300
  SIZE 500 500

  SYMBOL NAME 'vertex' TYPE ELLIPSE POINTS 1 1 END FILLED TRUE END

  LAYER
    NAME 'square'
    TYPE POLYGON
    STATUS DEFAULT
    FEATURE
      POINTS
        100 100
        250 100
        250 250
        100 250
        100 100
      END
    END
    
    CLASS
      STYLE
        COLOR 181 181 181
        OUTLINECOLOR 51 51 51
      END
      STYLE
        # GEOMTRANSFORM (centerline(densify([shape],2)))
        GEOMTRANSFORM (centerline([shape]))
        COLOR 0 0 255
      END
    END
  END
END

@loom-agent

Copy link
Copy Markdown
Author

Hi,

It looks like a new rule was introduced today, or perhaps we missed it yesterday:

“Human-coordinated or uncoordinated (OpenClaw, etc.) use of agents for submission of contributions to the MapServer repository is banned.”

Based on this rule, I’m closing this PR.

We find this very disappointing. We understand that previous bad experiences with low-quality AI-generated code may have led to the rejection of our contributions, even though they were 100% human-supervised.

We wish everyone the best. Have a nice day.

@loom-agent loom-agent closed this Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted AI assisted backport branch-8-6 To backport a pull request to branch-8-6

Projects

None yet

Development

Successfully merging this pull request may close these issues.

centerline function causes GEOS errors

3 participants