Skip to content

Instantly share code, notes, and snippets.

@ABM-Dan
Last active June 22, 2016 16:06
Show Gist options
  • Save ABM-Dan/153d1bdcd626eb945e15bf0d1cb8a922 to your computer and use it in GitHub Desktop.
Save ABM-Dan/153d1bdcd626eb945e15bf0d1cb8a922 to your computer and use it in GitHub Desktop.
SELECT id, ST_Distance_Sphere(Point(-73.951368, 40.716743), geom) as distance_in_meters, tags, ST_AsText(geom)
FROM nodes
WHERE ST_Contains( ST_MakeEnvelope(
Point((-73.951368+(20/111)), (40.716743+(20/111))),
Point((-73.951368-(20/111)), (40.716743-(20/111)))
), geom )
AND match(tags) against ("+thai +restaurant" IN BOOLEAN MODE)
ORDER BY distance_in_meters LIMIT 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment