Kevin, Actually this would help me with the second phase, but for the first phase I just need consistency which I was hoping AsText would do for me. It doesn't even need to be that good since I'm sure the other side is using AsText in some fashion. So I just need consistency more than correctness.
Where I start off with Orginal geometry X I think I need to guarantee that X = GeomFromText(AsText(X)) Seemed like the easiest way to assure that was to just force all my Xs to X = ST_GeomFromText(AsText(X), somesrid) which I presume should be the same as ST_SetSRID(AsText(X), somesrid) The back end editor I'm assuming is just taking the AsText(geometry) representation and just returning that back when no edits on a particular point, and so its being poisoned by its own database query. I'm not working on that part so that's just my general observation. Thanks, Regina -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Neufeld Sent: Friday, May 16, 2008 11:15 AM To: PostGIS Users Discussion Subject: Re: [postgis-users] Does ST_AsText truncate or round Have you considered using ST_SnapToGrid() and make all geometries in you database respect a specified tolerance? Warning, snaptogrid may not behave as you might expect - this is not a simple precision_reducer method (which I think would be valuable). Consider: select 'POINT(0.877 0.778)'::geometry ~= snaptogrid('POINT(0.87689017271623 0.777984935324639)'::geometry, 0.001); ?column? ---------- t (1 row) No problem there, but then there's this: select 'POINT(0.956 0.66)'::geometry ~= snaptogrid('POINT(0.956079571507871 0.659502930939198)'::geometry, 0.001); ?column? ---------- f (1 row) To deal with this (I know it looks like a hack, but it works), I convert to text and then back to a geometry. Wrapping this in a trigger on your geometry tables will guarantee any geometry edits are automatically reduced to a certain precision. select 'POINT(0.956 0.66)'::geometry ~= geomfromtext(astext(snaptogrid('POINT(0.956079571507871 0.659502930939198)'::geometry, 0.001)), -1); ?column? ---------- t (1 row) Cheers, Kevin Paragon Corporation wrote: > Slight clarification about what I am trying to solve. > > After edits I am coming back with lines that used to be intersecting > no longer intersecting and that still have the same AsText representation. > > My hope is to reduce the precision of my geometry in the database so > the edits don't break the topology of my lines by doing something like > this > > > Update sometable > SET the_geom = ST_SetSRID(ST_AsText(the_geom), mysrid) > > > But I fear that if AsText is doing a rounding rather than a > truncation, that I run the risk of breaking things that used to > intersect. I am more concerned about under intersecting than over > intersecting. Although I probably haven't thought this out enough so maybe it's a non-issue. > > Thanks, > Regina > > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Paragon Corporation > Sent: Friday, May 16, 2008 12:01 AM > To: 'PostGIS Users Discussion' > Subject: [postgis-users] Does ST_AsText truncate or round > > Hopefully this is a simple question. I know that ST_AsText returns a > geometry that is not necessarily as prescise as what is actually > stored in the geometry field. I have an editor that relies on WKT representation. > > Anyrate just wanted to know if the ST_AsText does a rounding of the > points or it does a truncation of the points. Also would be nice to > know if I could control the precision of this since I will need to > truncate my actual geometry accordingly so that both are in agreement. > > Thanks, > Regina > > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users