[postgis-users] Re: two different geometries with the same Astext

Miguel de la Fuente mjdelafuente at gmail.com
Tue Jul 19 06:35:36 PDT 2005


Thanks to everybory for your answers.

I'll try to make a better description of the problem an what I made
related to your answer.

To simplify the problem for you to analize it, I first extracted an
example from the source tables to a new table with a SELECT command:

select 
a.the_geom as g1,
b.the_geom as g2
into pru
from p107_fm_co a, p107_mz_co b 
where a.gid=618 and b.gid=2

and the I ran the following

select astext(g1),astext(g2),
within(geometryfromtext(astext(g1)),geometryfromtext(astext(g2)))as w1,
within(g1,g2) as w2
from pru

and I got

--"MULTILINESTRING((5256301.4 6014697.56,5256369.25
6014741.46))";"MULTILINESTRING((5256369.25 6014741.46,5256456.23
6014607.03,5256388.39 6014563.13,5256301.4 6014697.56,5256369.25
6014741.46))";t;f

as you could see the first within return TRUE and the second return
FALSE and that is what I can't understand

But, the worst thing of all is that when I made a backup of the table
to attach it this message I got this:

CREATE TABLE pru (g1 geometry, g2 geometry);
ALTER TABLE public.pru OWNER TO postgres;
INSERT INTO pru (g1, g2) VALUES
('0105000000010000000102000000020000009A9999591B0D54413D0AD763BAF15641000000502C0D5441D7A3705DC5F15641',
'010500000001000000010200000005000000000000502C0D5441D7A3705DC5F15641EC51B80E420D54411F85EBC1A3F156418FC2F518310D544185EB51C898F156419A9999591B0D54413D0AD763BAF15641000000502C0D5441D7A3705DC5F15641');

I dropped the table made with the SELECT command described above and
re-created the table running this script.
And the I run:

select astext(g1),astext(g2),
within(geometryfromtext(astext(g1)),geometryfromtext(astext(g2)))as w1,
within(g1,g2) as w2
from pru

again and I got

--"MULTILINESTRING((5256301.4 6014697.56,5256369.25
6014741.46))";"MULTILINESTRING((5256369.25 6014741.46,5256456.23
6014607.03,5256388.39 6014563.13,5256301.4 6014697.56,5256369.25
6014741.46))";t;t

with both withins returning TRUE !!!!!

I'm really LOST!



More information about the postgis-users mailing list