Skip to main content
added 482 characters in body
Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

You are checking if a Polygon is inside a Point!

ST_Contains(A, B) checks if

Geometry A contains Geometry B [...] - docs



Switch the arguments to ST_Contains!:

SELECT samplecol.name_city,
       samplecol.latitude,
       samplecol.longitude
FROM   samplecol
WHERE  ST_Contains(
         ST_SetSRID(
           'POLYGON((-15.0292969 47.6357836,-15.2050781 47.5172007,-16.2597656 29.3821751,35.0683594 26.1159859,38.0566406 47.6357836,-15.0292969 47.6357836))'::GEOMETRY,
           <SRID>
         ),
         samplecol.the_geom
       )
;

Note that you need to set <SRID> to the same CRS of samplecol.geom.

You are checking if a Polygon is inside a Point!

ST_Contains(A, B) checks if

Geometry A contains Geometry B [...] - docs



Switch the arguments to ST_Contains!

You are checking if a Polygon is inside a Point!

ST_Contains(A, B) checks if

Geometry A contains Geometry B [...] - docs



Switch the arguments to ST_Contains:

SELECT samplecol.name_city,
       samplecol.latitude,
       samplecol.longitude
FROM   samplecol
WHERE  ST_Contains(
         ST_SetSRID(
           'POLYGON((-15.0292969 47.6357836,-15.2050781 47.5172007,-16.2597656 29.3821751,35.0683594 26.1159859,38.0566406 47.6357836,-15.0292969 47.6357836))'::GEOMETRY,
           <SRID>
         ),
         samplecol.the_geom
       )
;

Note that you need to set <SRID> to the same CRS of samplecol.geom.

Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

You are checking if a Polygon is inside a Point!

ST_Contains(A, B) checks if

Geometry A contains Geometry B [...] - docs



Switch the arguments to ST_Contains!