[postgis-users] getPrefix() lies me?

Markus Schaber schabi at logix-tt.com
Fri Mar 24 07:22:05 PST 2006

Hi, Marcos,

marcos boullón magán wrote:

> ... to remove the first component, then get the coordinates. But when
> OrbisCAD makes a "select extent() ..." and calls PGboxbase with a
> string value "BOX(coord1 coord2, coord3 coord4)", the method
> getPrefix(value) returns a BOX3D prefix not a "BOX" prefix, and I get
> a cascade of errors: if the code cannot remove here the prefix, when
> code arrives at PGtokenizer a crash happens.

This tells me that your instance is a PGBox3D, not a PGbox2D. Note that
PGboxbase is an abstract superclass that is never instantiated itsself.

It was intentionally to remove only the correct prefix, as parsing with
incorrect prefixes usually points to a bug in the code. But I admit that
this is not clear in the code, I should have added an else branch that
throws an exeption to the "if (value.startsWith(myPrefix))" clause.

I don't know OrbisCAD, but I can imagine that it was written with
PostGIS 0.X in mind where PGbox2D did not exist, and the server always
returned a BOX3D object at extent(). So it is the server that changed
output, breaking a client.

We can make the Box3D parser accept BOX() syntax along with the BOX3D(),
and possibly allow the Box2D parser to parse BOX3D() syntax if it does
not actually use the 3rd dimension.

Doing this, we should keep in mind that other things might break when
OrbisCAD sends the Box3D() where the server wants a Box2D.

However, your patch does too much IMHO, it completely throws away the
first word. I see value in catching strange errors e. G. from
accidentaly feeding a MULTIPOINT(1 2 3, 4 5 6) into the PGbox3D parser.

Are you in contact with the OrbisCAD developers? Do you know what they
think about it? Should we escalate the discussion to their list / forum
/ group or whatever?


Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

More information about the postgis-users mailing list