[postgis-users] Patch for casting geometry to geography

Marshall, Steve smarshall at wsi.com
Fri Jan 21 15:04:47 PST 2011


I've added this patch as item #799 on OSGEO.  

I understand the philosophy of failing loudly; in many cases it is the right thing to do.  However the longitude values I described are not truly errors, and arise from what I think is legitimate use of spatial reference system EPSG:4326.  For anyone who is trying to migrate from geometries to geographies, I think a more forgiving casting function will be a huge advantage.  For this reason, I hope the change will be accepted.

Steve Marshall


-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul Ramsey
Sent: Friday, January 21, 2011 12:03 PM
To: PostGIS Users Discussion; PostGIS Development Discussion
Subject: Re: [postgis-users] Patch for casting geometry to geography

Note, I originally intended to do a lot of this kind of quiet
helpfulness but -devel persuaded me not to, on the principle that it
was better to fail noisily ("can't deal with these coordinates!") than
to screw up silently (incorrectly "fixing" things that shouldn't be
fixed).
P

On Thu, Jan 20, 2011 at 3:07 PM, Paragon Corporation <lr at pcorp.us> wrote:
> Steve,
>
> It would help if you posted this issue as a bug ticket and then attach the
> patch to it.
> http://trac.osgeo.org/postgis/newticket
>
> That way it will get on our list on items.
>
>
>
> Since it doesn't require an external function addition, I think it can be
> slated for PostGIS 1.5.3
>
> Thanks,
> Regina
> http://www.postgis.us
>
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> Marshall, Steve
> Sent: Thursday, January 20, 2011 3:29 PM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Patch for casting geometry to geography
>
> Related to an earlier post by Radu Ilie, 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.
>
> I hope this could be included in a future PostGIS release.  If necessary, I
> can post this to a different list.
>
> Steve Marshall
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list