#1978 closed defect (fixed)
STLength of three-point closed circularstrings incorrect
Reported by: | pnalos | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | |
Component: | postgis | Version: | 2.0.x |
Keywords: | Cc: |
Description
Q: SELECT PostGIS_full_version(); A: "POSTGIS="2.0.0 r9605" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER"
Q: select ST_Length(ST_GeomFromText('CIRCULARSTRING(0 0,1 0,0 0)',0)) A: 1.0 <--- incorrect, should be pi
If I split the geometry into two parts: Q: select ST_Length(ST_GeomFromText('CIRCULARSTRING(0.5 -0.5,1 0,0.5 0.5,0 0,0.5 -0.5)',0)) A: 3.14127725093278 <--- correct
Apologies if this has been solved; I don't have the latest release or svn head installed.
Aside: My previous PostGIS ("POSTGIS="1.5.0" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.6.1, 21 August 2008" LIBXML="2.7.6" USE_STATS") returns zero for all circularstring length queries I could think of.
Change History (3)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 12 years ago
For 1.5 it would take a fair bit more work. It it's critical please set up a new ticket against 1.5
Thanks very much. This is certainly not critical for us. Our interest was limited to, "SQL Server 2012 doesn't support closed three-point circularstrings, so we turn those into five-point circularstrings when inserting data. Do we need to do something similar for PostGIS?" The answer is, "No, PostGIS is just fine with three-point closed circularstrings." -Paul Nalos, Safe Software
Arg, this is actually a bug in lwcircstring_segmentize! {{{double lwcircstring_length_2d(const LWCIRCSTRING *circ) {
} }}} Which makes me want to re-write the length function to actually work on arcs...! But since this bug exists back into early pre-history, I'm going to have to track the problem in segmentize instead for now.