Naiara Pedrozo
Naiara Pedrozo

Reputation: 3

PostGIS and coordinates, determinate if a point is inside a multipolygon

I have the coordinates: -48.54367281530538 -15.91180231568948

I need to know if these coordinates belong to my multpolygon

select boolean st_contains(st_geomfromtext('POINT(-48.54367281530538 -15.91180231568948)',4326), st_geomfromkml(a.geom)) 
from "LIM_Municipio_A" as a
where nome  ilike 'alexânia';

My Table:

Upvotes: 0

Views: 60

Answers (1)

JGH
JGH

Reputation: 17836

The doc says:

boolean ST_Contains(geometry geomA, geometry geomB);
Geometry A contains Geometry B if [...]

So you would have to use the polygon first, then the point.

select st_contains(
    st_geomfromkml(a.geom),
    st_geomfromtext('POINT(-48.54367281530538 -15.91180231568948)',4326)
   ) 
from "LIM_Municipio_A" as a
where nome  ilike 'alexânia';

Upvotes: 2

Related Questions