<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>RE: [postgis-users] Does ST_AsText truncate or round</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Regina --<BR>
<BR>
I think the lwgi is testing for whether the installation has the "light-weight" postGIS stuff -- fewer decimal places resulting (%f and %g are formatting options in a print statememnt for decimal representation -- so 8 or 15 places respectively.<BR>
<BR>
(I think -- never crawled into the guts of postGIS' C code).<BR>
<BR>
(Sorry for top posting and the disclaimer -- only one per thread, I promise!)<BR>
<BR>
Greg Williamson<BR>
Senior DBA<BR>
DigitalGlobe<BR>
<BR>
Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information and must be protected in accordance with those provisions. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.<BR>
<BR>
(My corporate masters made me say this.)<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: postgis-users-bounces@postgis.refractions.net on behalf of Obe, Regina<BR>
Sent: Fri 5/16/2008 12:33 PM<BR>
To: PostGIS Users Discussion<BR>
Subject: RE: [postgis-users] Does ST_AsText truncate or round<BR>
<BR>
Paul,<BR>
<BR>
I think you mistook me for a C programmer if you actually thought I<BR>
could figure out my answer from this snippet of code :)<BR>
<BR>
First I can't remember what g means.  I remember seeing fs and gs<BR>
somewhere before so I can only assume that f means round and g means<BR>
truncate?<BR>
<BR>
Secondly what does lwgi stand-for - I can only guess it means<BR>
light-weight geom or something along that  - so does that mean that as<BR>
far as I'm concerned - .8g is the loop I'm interested in?  Do we even<BR>
use non-light weight anymore?<BR>
<BR>
Thanks,<BR>
Regina<BR>
<BR>
-----Original Message-----<BR>
From: postgis-users-bounces@postgis.refractions.net<BR>
[<A HREF="mailto:postgis-users-bounces@postgis.refractions.net">mailto:postgis-users-bounces@postgis.refractions.net</A>] On Behalf Of Paul<BR>
Ramsey<BR>
Sent: Friday, May 16, 2008 10:39 AM<BR>
To: PostGIS Users Discussion<BR>
Subject: Re: [postgis-users] Does ST_AsText truncate or round<BR>
<BR>
It all falls down into this function:<BR>
<BR>
write_double(double val){<BR>
        ensure(32);<BR>
        if (lwgi)<BR>
                sprintf(out_pos,"%.8g",val);<BR>
        else<BR>
                sprintf(out_pos,"%.15g",val);<BR>
        to_end();<BR>
}<BR>
<BR>
<BR>
<BR>
On Fri, May 16, 2008 at 3:23 AM, Paragon Corporation <lr@pcorp.us><BR>
wrote:<BR>
> Slight clarification about what I am trying to solve.<BR>
><BR>
> After edits I am coming back with lines that used to be intersecting<BR>
no<BR>
> longer intersecting and that still have the same AsText<BR>
representation.<BR>
><BR>
> My hope is to reduce the precision of my geometry in the database so<BR>
the<BR>
> edits don't break the topology of my lines by doing something like<BR>
this<BR>
><BR>
><BR>
> Update sometable<BR>
>        SET the_geom = ST_SetSRID(ST_AsText(the_geom), mysrid)<BR>
><BR>
><BR>
> But I fear that if AsText is doing a rounding rather than a<BR>
truncation, that<BR>
> I run the risk of breaking things that used to intersect.  I am more<BR>
> concerned about under intersecting than over intersecting.  Although I<BR>
> probably haven't thought this out enough so maybe it's a non-issue.<BR>
><BR>
> Thanks,<BR>
> Regina<BR>
><BR>
><BR>
><BR>
> -----Original Message-----<BR>
> From: postgis-users-bounces@postgis.refractions.net<BR>
> [<A HREF="mailto:postgis-users-bounces@postgis.refractions.net">mailto:postgis-users-bounces@postgis.refractions.net</A>] On Behalf Of<BR>
Paragon<BR>
> Corporation<BR>
> Sent: Friday, May 16, 2008 12:01 AM<BR>
> To: 'PostGIS Users Discussion'<BR>
> Subject: [postgis-users] Does ST_AsText truncate or round<BR>
><BR>
> Hopefully this is a simple question.  I know that ST_AsText returns a<BR>
> geometry that is not necessarily as prescise as what is actually<BR>
stored in<BR>
> the geometry field.  I have an editor that relies on WKT<BR>
representation.<BR>
><BR>
> Anyrate just wanted to know if the ST_AsText does a rounding of the<BR>
points<BR>
> or it does a truncation of the points.  Also would be nice to know if<BR>
I<BR>
> could control the precision of this since I will need to truncate my<BR>
actual<BR>
> geometry accordingly so that both are in agreement.<BR>
><BR>
> Thanks,<BR>
> Regina<BR>
><BR>
><BR>
> _______________________________________________<BR>
> postgis-users mailing list<BR>
> postgis-users@postgis.refractions.net<BR>
> <A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>
><BR>
><BR>
> _______________________________________________<BR>
> postgis-users mailing list<BR>
> postgis-users@postgis.refractions.net<BR>
> <A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>
><BR>
_______________________________________________<BR>
postgis-users mailing list<BR>
postgis-users@postgis.refractions.net<BR>
<A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>
-----------------------------------------<BR>
The substance of this message, including any attachments, may be<BR>
confidential, legally privileged and/or exempt from disclosure<BR>
pursuant to Massachusetts law. It is intended<BR>
solely for the addressee. If you received this in error, please<BR>
contact the sender and delete the material from any computer.<BR>
<BR>
_______________________________________________<BR>
postgis-users mailing list<BR>
postgis-users@postgis.refractions.net<BR>
<A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>