I have a file that contains location points all over the world, using lat long coordinates. I am trying to trim it down to only new York and Newark new jersey. I have a shape file that is the boundaries of new York and includes new jersey but is in shape area and shape length. I am trying to extract the data points that fall in those boundaries but I am stuck. Does anyone know how to do this in carto or any other program?

1 Answer 1


You can do that with SQL and PostGIS in Carto's SQL tray. If your table of NY boundaries is ny_boundaries and your point dataset is points_data, then the following query will do the filtering for you:

FROM points_data As p
JOIN ny_boundaries As n
ON ST_Intersects(p.the_geom, n.the_geom)

You can leave the query applied to keep that view of the data, or create a new dataset from the query.

Docs on Carto's SQL tray: https://carto.com/docs/carto-editor/managing-your-data/#running-sql-queries Lessons on SQL: https://carto.com/academy/courses/sql-postgis/

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.