[postgis-users] getting unexpected results on an ST_Intersects query

Hugues François hugues.francois at irstea.fr
Sat Apr 5 13:13:23 PDT 2014


Hello,

It's difficult to give an answer since you don't tell us a lot about unexpected results buy you could try something like (will not work if  a ft_cubo's polygon intersects different sigfre_cub_adm_munic polygons) :

UPDATE
  ft_cubo
SET
  gidmunic = mgid
FROM (
SELECT DISTINCT ft_cubo.gid AS cgig, sigfre_cub_adm_munic.gid AS mgid
FROM sigfre_cub_adm_munic, ft_cubo
WHERE
ST_Intersects(ft_cubo.the_geom,sigfre_cub_adm_munic.the_geom)
) AS foo
WHERE gid = cgid

HTH

If it's not give the expected results, you can work on the subselect query to return the expected unique gid pairs.

Hugues.



-----Message d'origine-----
De : postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] De la part de islanis at infomed.sld.cu
Envoyé : samedi 5 avril 2014 21:28
À : postgis-users at lists.osgeo.org
Objet : [postgis-users] getting unexpected results on an ST_Intersects query

Hi folks, I'm having problems when I try to run a simple query to update the gidmunic field of ft_cubo layer, and it assigns a value that does not exists in said field, please, i need help , the two layers are multipolygon type. what should I do?


UPDATE
  ft_cubo
SET
  gidmunic = sigfre_cub_adm_munic.gid
FROM sigfre_cub_adm_munic
WHERE
ST_Intersects(ft_cubo.the_geom,sigfre_cub_adm_munic.the_geom);



thanks in advance

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



--

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list