Back to Playground Home

Indicates how many points fit within the polygon

select ST_Within(
         toGeometry(bytes_field), 
         ST_GeomFromText(
           'POLYGON((-19.511718750000004 56.9449741808516,-20.917968749999996 41.112468789180895,-10.722656250000007 34.01624188966704,31.113281249999986 34.597041516144174,43.417968749999986 39.77476948529545,39.550781249999986 50.736455137010665,0.1757812499999952 62.02152819100766,-19.511718750000004 56.9449741808516))')) AS withinPolygon, 
       count(*) 
from users
group by withinPolygon
ORDER BY withinPolygon DESC