Skip to content

Instantly share code, notes, and snippets.

@rlisowski
Created November 9, 2017 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlisowski/16e8a93192c071456f3d2b1b79595c61 to your computer and use it in GitHub Desktop.
Save rlisowski/16e8a93192c071456f3d2b1b79595c61 to your computer and use it in GitHub Desktop.
MapFIlter filter
Location.
where('ST_Covers(?, coordinates)', Shapefile.where(area_name: 'BR2').first.geometry.to_s).
size
# produces two SQL queries, the filter query look like
# SELECT Count(*)
# FROM "location"
# WHERE (
# St_covers(
# 'MULTIPOLYGON (((0.004218521268697022 51.38840811418139, ... , 0.004218521268697022 51.38840811418139)))'
# , coordinates
# )
# )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment