1

I have two geometries:

multi point A

multi polygon B

I want to get all the points of A that overlap with the polygon B

I am not sure how to run this query. I have tried the following query:

SELECT ST_Intersection(A.geom, B.geom)
FROM point AS A, poly AS B

But with little succes. How can I change it so that i get only the points of A that are overlap with B?

2

You have to add a WHERE clause so with the ST_INTERSECTS clause returns a boolean value if the Geometries/Geography spatially intersect in 2D, while ST_Intersection returns a geometry that represents the point set intersection of the geometries (as per documentation).

so the query needs to be:

SELECT field1, field2, field3
FROM point as A, poly AS B 
WHERE ST_INTERSECTS(A.geom, B.geom)

for more insight have a look at the documentation of ST_Intersects

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.