chargetrip / clusterbuster

A Mapbox Vector Tile (MVT) map tiling server with built-in clustering and filtering
MIT License
92 stars 18 forks source link

Filter by polygon #90

Open dwweb0309 opened 1 year ago

dwweb0309 commented 1 year ago

filtersToWhere function is great for filtering but how can we filter points by polygon?

cosmin-petrescu commented 1 year ago

Hello,

You can achieve this by using some of the PostgreSQL methods:

  1. ST_Contains - ST_Contains(GeomFromText('POLYGON((long1 lat1, long2 lat2, long3 lat3))'), my_geometry_column)
  2. ST_Within - ST_Within(my_geometry_column, GeomFromText('POLYGON((long1 lat1, long2 lat2, long3 lat3))'))

You just need to return them within filtersToWhere result.