History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: NHSP-5
Type: Patch Patch
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Ricardo Stuven
Reporter: Nathan Stults
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
NHibernate.Spatial

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

Created: 24/Feb/09 10:06 PM   Updated: 08/Mar/09 10:20 PM
Component/s: DataProviders / Dialects
Affects Version/s: 1.0.0.Beta2
Fix Version/s: 1.0.0.Beta3

File Attachments: 1. Text File PostGisDataTypePatch.patch (0.7 kb)



 Description  « Hide
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.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Ricardo Stuven - 08/Mar/09 10:20 PM
Resolved in revision 810.