Incorrect conversion from BOX to WKT POLYGON in PostGIS Geometry Data Type

Description

The Geomery data type for the PostGIS dialect does a manual transformation of a BOX result from PostGIS, which is returned when the Envelope projection is used. Data point 4 is incorrectly created using to longitude points. Currently, the string format used is this:

string wkt = string.Format(
"POLYGON(({0} {1},{2} {1},{2} {3},{0} {2},{0} {1}))",
min[0], min[1], max[0], max[1]);

The fourth data point is formatted as {0} {2} - which equals min[0] and max[0] - both of which refer to longitude points. To match what PostGIS returns from st_AsEWKT, the format should be:

string wkt = string.Format(
"POLYGON(({0} {1},{0} {3},{2} {3},{2} {1},{0} {1}))",
min[0], min[1], max[0], max[1]);

Both of these formats cause the Envelope Projection unit test to pass. I am including a patch for the change (although probably not needed), but the unit test should probably be modified to detect the problem. I can't compile the solution without heavy modifications due to missing references, so I'm not including that.

Environment

None

Attachments

1

Activity

Show:

Ricardo Stuven March 8, 2009 at 10:20 PM

Resolved in revision 810.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created February 24, 2009 at 9:06 PM
Updated March 8, 2009 at 10:20 PM
Resolved March 8, 2009 at 10:20 PM
Who's Looking?