This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--First, this is quick hack ported from https://github.com/fruminator/openstreetblock/ | |
--Replace the latitude and longitude accordly on the different places and encode the whole SQL or it will not work | |
http://vizzuality.cartodb.com/api/v1/sql?q= | |
select l.name, l.osm_id from osm_line l join way_nodes wn on l.osm_id = wn.way_id where wn.node_id = ( select n.id from nodes n where ARRAY[n.id::integer] && (select w.nodes from osm_line l join osm_ways w on l.osm_id = w.id where st_intersects(way , ST_buffer(ST_SetSRID(ST_MakePoint(-73.999548,40.71954),4326), .002)) order by way <-> ST_SetSRID(ST_MakePoint(-73.999548,40.71954),4326) limit 1) order by n.geom <-> ST_SetSRID(ST_MakePoint(-73.999548,40.71954),4326) limit 1) and wn.way_id != ( select osm_id from osm_line l join osm_ways w on l.osm_id = w.id where st_intersects(way, ST_buffer(ST_SetSRID(ST_MakePoint(-73.999548,40.71954),4326), .002) ) LIMIT 1) and l.name is not null and l.name != '' | |