Opened 13 years ago

Closed 13 years ago

#3621 closed enhancement (fixed)

Support Curved features in PostGIS

Reported by: pramsey Owned by: pramsey
Priority: normal Milestone: 6.0 release
Component: PostGIS Interface Version: 5.6
Severity: normal Keywords: curve
Cc: jmckenna, astrid.emde@…, benjamin.mueller@…

Description

The SQL/MM curve types (CircularString, CompoundCurve, CurvePolygon, MultiCurve, MultiSurface) are not currently supported by the PostGIS driver. They should be stroked to equivalent linestring based features and then passed to the standard rendering stack.

Attachments (9)

ms-curve-20101127.patch (28.5 KB ) - added by pramsey 13 years ago.
First cut of a patch
ms-curve-20101128.patch (28.0 KB ) - added by pramsey 13 years ago.
handles closed circles and straight curves
ms-curve-20101129.patch (42.2 KB ) - added by pramsey 13 years ago.
Added more comments, and preemptive support for PostGIS 2.0
ms-curve-20101130.patch (45.3 KB ) - added by pramsey 13 years ago.
Remove unneeded SQL functions and add a few more comments
ms6-curve-20101130.patch (62.7 KB ) - added by pramsey 13 years ago.
Patch for MS6 (trunk)
ms6-curve-20101201.patch (62.9 KB ) - added by pramsey 13 years ago.
Patch against trunk w/ VCC changes
test.sql (1.6 KB ) - added by jmckenna 13 years ago.
Test SQL to load SQL-MM curves that are listed in the PostGIS documentation.
curve.png (65.8 KB ) - added by astrid_emde 13 years ago.
first test with MS6.0 - not enough basepoints
ms6-curve-20101220.patch (63.1 KB ) - added by pramsey 13 years ago.
denser curve treatment

Download all attachments as: .zip

Change History (22)

by pramsey, 13 years ago

Attachment: ms-curve-20101127.patch added

First cut of a patch

comment:1 by pramsey, 13 years ago

Cc: jmckenna added

It looks like the two special cases of circular arcs that form circles and circular arcs that are co-linear are not being correctly handled right now. Need to address those.

comment:2 by pramsey, 13 years ago

Cc: astrid.emde@… added; jmckenna removed

comment:3 by pramsey, 13 years ago

Cc: jmckenna added

by pramsey, 13 years ago

Attachment: ms-curve-20101128.patch added

handles closed circles and straight curves

by pramsey, 13 years ago

Attachment: ms-curve-20101129.patch added

Added more comments, and preemptive support for PostGIS 2.0

by pramsey, 13 years ago

Attachment: ms-curve-20101130.patch added

Remove unneeded SQL functions and add a few more comments

by pramsey, 13 years ago

Attachment: ms6-curve-20101130.patch added

Patch for MS6 (trunk)

comment:4 by jmckenna, 13 years ago

Paul, I'm testing the MS6(trunk) patch, building on Windows with MSVC 2008, and I was getting errors of "undeclared identifier M_PI", so I added the following to mappostgis.c locally:

(line 63)
/* required for MSVC */
#define _USE_MATH_DEFINES

(line 68)
#include <math.h>

With that change, MapServer compiles and I am able to generate a map image of your table's curvepolygons.

comment:5 by jmckenna, 13 years ago

For some reason hunk#5 and #10 of that patch fail for patching mappostgis.c for me...will take a look (I deleted my old mappostgis.c and re-checked out a fresh one...odd)

comment:6 by jmckenna, 13 years ago

Paul your 'ms6-curve-20101130.patch' was made against r10772 but 'ms6-curve-20101201.patch' was made against r10769 ? was this on purpose?

comment:7 by pramsey, 13 years ago

Figured it out, I pulled the last one against the 5.6 branch instead of against trunk, and the trunk patch is on my laptop, not this desktop machine. Curses. One moment.

by pramsey, 13 years ago

Attachment: ms6-curve-20101201.patch added

Patch against trunk w/ VCC changes

by jmckenna, 13 years ago

Attachment: test.sql added

Test SQL to load SQL-MM curves that are listed in the PostGIS documentation.

comment:8 by jmckenna, 13 years ago

by astrid_emde, 13 years ago

Attachment: curve.png added

first test with MS6.0 - not enough basepoints

comment:9 by astrid_emde, 13 years ago

Cc: benjamin.mueller@… added

Benj did some tests - his output generates lines with not enough base points (see output http://trac.osgeo.org/mapserver/attachment/ticket/3621/curve.png). So the lines did not fit on each other. Is there a parameter to produce more base points in the mapfile?

comment:10 by pramsey, 13 years ago

The problem is that the number of segments is currently dictated by the angular distance covered by the arc segment. If it's a big angular distance, more points, a shallow angle, fewer. I think I'm going to have to completely change that logic to be more of a "number of points between start and end" basis. That will exchange underdetermination in the cases above with overdetermination (too many points) for very short segments. The trouble is, we cannot distinguish "very short" easily without more contextual information than we have about resolution, etc.

by pramsey, 13 years ago

Attachment: ms6-curve-20101220.patch added

denser curve treatment

comment:11 by pramsey, 13 years ago

Give this patch a shot. All these approaches are going to end up looking a little non-dense if you zoom in enough on a sufficiently shallow curve. I just found that over-dense lines looked bad in their own way. You can alter the SEGMENT_ANGLE and SEGMENT_MINPOINTS values at compile to for the moment to get different behaviour.

comment:12 by astrid_emde, 13 years ago

Feedback from Benjamin. The patch works fine. Thanks for the enhancement.

comment:13 by pramsey, 13 years ago

Resolution: fixed
Status: newclosed

Committed to trunk at r10846

Note: See TracTickets for help on using tickets.