Opened 14 years ago
Closed 12 years ago
#799 closed enhancement (fixed)
Patch for casting geometry to geography
Reported by: | smarshall | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.1.0 |
Component: | postgis | Version: | 1.5.X |
Keywords: | Cc: |
Description
Related to a post by Radu Ilie on Jan 20, 2011, I have a patch for casting from geometry to geography that solves his problem. In particular, it will transform coordinates into the desired range for geography objects (-90 to 90 lat, -180 to 180 lon). The previous version detected this problem, but simply issued an error if it occurred.
The attached files add one new external function to the the postgis library (lwgeom_force_geodetic) and uses it in the function that casts geometry objects to geography objects (Datum geography_in). The logic is a very simple clone of the lwgeom_check_geodetic function, except it fixes any descrepancies it finds.
The API at the SQL level is not changed at all.
Attachments (1)
Change History (7)
by , 14 years ago
Attachment: | geography_cast_patch.tar.gz added |
---|
comment:1 by , 13 years ago
Milestone: | PostGIS 1.5.3 → PostGIS 1.5.4 |
---|
comment:2 by , 13 years ago
Should note that the idea of auto-normalizing (and auto-projecting) coordinates while casting to geography was explicitly rejected by folks during the initial development. This issue should be discussed on postgis-devel before being applied.
comment:3 by , 13 years ago
Milestone: | PostGIS 1.5.4 → PostGIS 2.1.0 |
---|
I added geography nudging which pushes silghtly offside points onside. I don't think we can accept this for 1.5 in any event, it's a big behavior change.
comment:5 by , 12 years ago
Couple of comments:
- It would be better to raise a WARNING or NOTICE about normalization
- There may be the possibility to reduce coordinate copies in ptarray_force_geodetic by directly referencing the serialized point array.
Updated to include changes to geography_in (cast from text)