0

I want to intersect two polygons; they are in two tables stored in PostgreSQL. The names are "poligono" and "categorias_eot_paramo", respectively.

I am using the next simple syntax because I want to check the results where polígono intersect categorias_eot_paramo with the attributes from table categorias_eot_paramo.

SELECT ST_AsText(ST_Intersection(poligono.geom, categorias_eot_paramo)); 

and then, I got the next error:

ERROR:  missing FROM-clause entry for table "poligono"
LINE 1: SELECT ST_AsText(ST_Intersection(poligono.geom, categorias_e...
                                         ^
SQL state: 42P01
Character: 34

3
  • do your polygons really intersect each other? gis.stackexchange.com/a/215949/276
    – Mapperz
    Commented Dec 9, 2022 at 20:25
  • 1
    You forgot to select FROM some_table in your statement. Commented Dec 10, 2022 at 0:44
  • 1
    We use a Question/Answer model here. Please do not edit the Question to contain an answer.
    – Vince
    Commented Dec 13, 2022 at 2:17

1 Answer 1

3

As the error message says, you must specify the involved tables in the from clause. You may also want to limit the result to the actual intersections, else it would also create empty intersections.

SELECT ST_AsText(ST_Intersection(poligono.geom, categorias_eot_paramo.geom))
FROM poligono
 JOIN categorias_eot_paramo
  ON ST_INTERSECTS(poligono.geom, categorias_eot_paramo.geom); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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