[postgis-users] Does ST_AsText truncate or round

Obe, Regina robe.dnd at cityofboston.gov
Fri May 16 11:59:58 PDT 2008


Havard,
 
I think as Mark mentioned  if it did it would violate the spec.  I think somewhere in the spec is some specification of guaranteed precision of WKT and if there isn't - text can never represent floating to complete accuracy.  The AsBinary I think on the other hand is exact fidelity.  So simply trying to make them equal would probably irritate people who need precision higher than what the WKT spec offers.
 
In my particular case of course this would be ideal - but I can't be selfish  :)
 
So I can live with the general rule that 
 
ST_GeomFromText(ST_AsText(geom), srid here) != geom
 
As long as I can override it by  updating my millions of geometries to so and 300 someodd tables with 
 
SET the_geom = ST_GeomFromText(ST_AsText(geom))
 
without too many weird side effects.  I may just try it and see if it causes other problems elsewhere.
 
testing with the badly edited records  it seems to at least make my other geometries just as inprecise as the edited ones so I get intersection where I should again.
 
Thanks,
Regina
 
 


________________________________

From: postgis-users-bounces at postgis.refractions.net on behalf of Havard Tveite
Sent: Fri 5/16/2008 2:41 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Does ST_AsText truncate or round



Sorry, for not making much sense here.  What I wanted to
say was that ST_AsText(geom) should be equivalent to geom,
meaning that if you go from the database/binary
representation of the geometry to the text representation
of the geometry (using ST_AsText) and then back to the
database/binary representation (using ST_GeomFromText),
you should end up with the same geometry that you
started out with.  This is important for applications
that use when WKT when talking to PostGIS.

Håvard


Mark Cave-Ayland wrote:
> Håvard Tveite wrote:
>> ST_GeomFromText(ST_AsText(geom)) != geom
>>
>> sounds like a bug to me (ignoring the SRS).
>>
>> Håvard
>
> No, since the SFS 1.1 specification supports only 2 dimensions with no
> SRS (and ST_AsText() is spec compliant). If you need the SRS then you
> should use the PostGIS-enhanced ST_EWKT() function which will output the
> extra information, but is not spec-compliant.
>
>
> ATB,
>
> Mark.
>
> --
> Mark Cave-Ayland
> Sirius Corporation - The Open Source Experts
> http://www.siriusit.co.uk <http://www.siriusit.co.uk/> 
> T: +44 870 608 0063
> _______________________________________________
> 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




-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080516/54728f44/attachment.html>


More information about the postgis-users mailing list