[postgis-users] problem with intersection
António M. Rodrigues
amcrgrodrigues at gmail.com
Tue May 19 03:24:19 PDT 2015
Hi all,
I need two intersect two tables with geometry columns.
I get holes in the resulting geometry (clip1) which I cannot explain and
must solve.
(white in file <Screenshot from 2015-05-19 10:50:36.png>).
The geometry tables are testes.inputt and testes.targett (which are samples
of two larger tables).
In my attempts to solve to problem, I tried to clean any topology problems
with st_cleangeometry and st_makevalid.
My code is:
----------
--step1:
alter table testes.inputt rename column the_geom to the_geom_old;
alter table testes.inputt add column the_geom geometry;
update testes.inputt set the_geom = st_cleangeometry(the_geom_old);
alter table testes.targett rename column the_geom to the_geom_old;
alter table testes.targett add column the_geom geometry;
update testes.targett set the_geom = st_cleangeometry(the_geom_old);
----------
--step2:
alter table testes.inputt rename column the_geom to the_geom_old2;
alter table testes.inputt add column the_geom geometry;
update testes.inputt set the_geom = ST_MakeValid(the_geom_old2);
alter table testes.targett rename column the_geom to the_geom_old2;
alter table testes.targett add column the_geom geometry;
update testes.targett set the_geom = st_cleangeometry(the_geom_old2);
----------
--step3:
DROP TABLE if exists testes.clip1;
CREATE TABLE testes.clip1 AS
SELECT testes.inputt.ikey, testes.targett.tkey, testes.inputt.iarea,
st_intersection(testes.inputt.the_geom,testes.targett.the_geom) as
the_geom
FROM testes.inputt, testes.targett
WHERE testes.inputt.the_geom && testes.targett.the_geom
AND st_intersects(testes.inputt.the_geom,testes.targett.the_geom);
screenshots and data can be found here:
https://www.dropbox.com/sh/9h622gj0qrz1cnx/AADHokAeVtnIC__6CAaqBEaia?dl=0
hope I was clear enough.
Thank you in advance.
regards,
António
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150519/2d7bc000/attachment.html>
More information about the postgis-users
mailing list