[postgis-users] Fwd: problem with points in polygon edge

Gustavo Martinez gmpuljak at yahoo.com.ar
Thu Mar 17 04:54:22 PDT 2022




-------- Mensaje reenviado --------
Asunto: 	Re: [postgis-users] problem with points in polygon edge
Fecha: 	Wed, 16 Mar 2022 15:21:31 -0300
De: 	Gustavo Martinez <gmpuljak at yahoo.com.ar>
A: 	Greg Troxel <gdt at lexort.com>



Hi Greg,

I can't share the database. Attached are 2 shapefiles with the data of 
the following example (consider that the queries run on the server):

- select b.grado, b.cuarto, count(idvms) from monitoreo.vms_2021 a, 
datos.cuadricula_05 b where a.idprts='20215019326' and 
st_within(a.geom,b.geom) group by 1,2;

Gives:

grado    cuarto    count
3857    NE    13
3857    NO    49
3857    SO    6
3858    SE    13
3958    NE    16
3958    SO    16
4058    NO    15
4059    NE    3
4059    SE    19
4159    NE    11
4159    NO    6
4159    SO    18
4259    NO    18
4259    SO    10
4260    SE    6
4360    NE    17
4360    SE    14
4459    NO    453
4460    NE    307


- select b.grado, b.cuarto, count(idvms) from monitoreo.vms_2021 a, 
datos.cuadricula_05 b where a.idprts='20215019326' and 
st_intersects(a.geom,b.geom) group by 1,2;

Gives:

grado    cuarto    count
3857    NE    13
3857    NO    49
3857    SO    6
3858    SE    13
3958    NE    16
3958    SO    16
4058    NO    15
4059    NE    3
4059    SE    19
4159    NE    11
4159    NO    6
4159    SO    18
4259    NO    18
4259    SO    10
4260    SE    6
4360    NE    17
4360    SE    14
4459    NO    461
4460    NE    315


- select b.grado, b.cuarto, count(idvms) from monitoreo.vms_2021 a, 
datos.cuadricula_05 b where a.idprts='20215019326' and 
monitoreo.dentro(a.geom,b.geom) group by 1,2;

Gives:

grado    cuarto    count
3958    SO    16
4259    NO    18
4059    NE    3
4159    NO    6
4460    NE    315
3857    NE    13
4159    SO    18
3958    NE    16
3857    SO    6
3857    NO    49
4360    NE    17
4260    SE    6
4259    SO    10
4459    NO    453
4058    NO    15
3858    SE    13
4360    SE    14
4059    SE    19
4159    NE    11


- select count(idvms) from monitoreo.vms_2021 where idprts='20215019326'

Gives:

count
1018

You can see that st_intersects adds points and st_within gives a lower 
count that the real one.


El 16/3/22 a las 14:30, Greg Troxel escribió:

> You still haven't explained what you are trying to do, and haven't
> posted your queries.  That's ok, but I have not further useful
> suggestions for you.
>
-- 

*Gustavo Martínez Puljak*

*
*cel: +549 11 64089000
Linkedin:www.linkedin.com/in/gustavomartinezpuljak 
<https://www.linkedin.com/in/gustavomartinezpuljak>

*
*/Que la tierra se vaya haciendo camino ante tus pasos,//
//que el viento sople siempre a tus espaldas,//
//que el sol brille cálido sobre tu cara,//
//que la lluvia caiga suavemente sobre tus campos y,//
//hasta tanto volvamos a encontrarnos,//
//que Dios te lleve en la palma de su mano./


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220317/a6155bff/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.zip
Type: application/zip
Size: 85034 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220317/a6155bff/attachment.zip>


More information about the postgis-users mailing list