Opened 15 years ago

Closed 15 years ago

#145 closed defect (fixed)

POLYGON( EMPTY) is unparseable

Reported by: robe Owned by:
Priority: medium Milestone: PostGIS 1.4.0
Component: postgis Version: 1.4
Keywords: Cc:

Description (last modified by pramsey)

What steps will reproduce the problem?

  1. SELECT

ST_GeomFromText(ST_AsText(ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326), 0)))

What is the expected output? It should return some hex binary since the buffer returns a POLYGON EMPTY

What do you see instead? a) On 1.3.5 (GEOS 3.0.3 )— gives error ERROR: parse error - invalid geometry CONTEXT: SQL function 'st_geomfromtext' statement 1

b) On POSTGIS='1.4.0SVN' GEOS='3.1.0-CAPI-1.5.0' PROJ='Rel. 4.6.0, 21 Dec 2007' USE_STATS

gives error ERROR: parse error - invalid geometry HINT: 'POLYGON( EMPTY' ←- parse error at position 14 within geometry

Note that:

SELECT ST_AsText(ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326), 0))

Yields: POLYGON( EMPTY) (whats that space after the first paren for? thought getting rid of the space doesn't help)

however:

SELECT ST_GeomFromText('POLYGON EMPTY') works fine.

Leo

Change History (7)

comment:1 by pramsey, 15 years ago

This is more than an input/output problem:

postgis14=# select ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326), 0); server closed the connection unexpectedly This probably means the server terminated abnormally

before or while processing the request.

The connection to the server was lost. Attempting reset: Failed. !> \q

postgis14=# select area(ST_Buffer(ST_GeomFromText('LINESTRING(-116.93414544665981 34.16033385105459,-116.87777514700957 34.10831080544884,-116.86972224705954 34.086748622072776,-116.9327074288116 34.08458099517253,-117.00216369088065 34.130329331330216,-117.00216369088065 34.130329331330216)', 4326), 0)); ERROR: getPoint2d_p: point offset out of range

Whatever is being returned by buffer is deeply malformed.

comment:2 by mcayland, 15 years ago

Yuck, that's definitely a bug. Can anyone get a suitable backtrace from this? And does changing GEOS version help at all?

ATB,

Mark.

comment:3 by robe, 15 years ago

Actually using the ST_Area was how we discovered the issue too when it broke our code using ST_Area with that getPoint2d_p. And on inspection it seemed that Buffer was just returning a POLYGON( EMPTY) which would otherwise be fine except we don't seem to know how to parse POLYGON(EMPTY). Shouldn't POLYGON(EMPTY) be a valid construct?

Though as Leo said its POLYGON(spaceEMPTY) its returning or at least that is how

PostGIS interprets it.

Now for Paul's example — testing on my Windows 8.3 1.4/3.1.0 install it doesn't crash — I get this

ERROR: geometry contains non-closed rings

comment:4 by pramsey, 15 years ago

Description: modified (diff)
Type: taskdefect

comment:5 by robe, 15 years ago

Milestone: postgis 1.4.0
Version: 1.4

Sandro's patch seems to have fixed this problem so I'm closing it out. Except I hmm can't find the close dropdown. I must have imported this bug wrong or its too early in the morning for me.

comment:6 by robe, 15 years ago

Reporter: changed from lr1234567 to robe

comment:7 by robe, 15 years ago

Resolution: fixed
Status: newclosed

fixed at r4187

Note: See TracTickets for help on using tickets.