Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
drop table if exists density_streets cascade;
create table density_streets as
with
-- сначала выбираются линии, на которых нужные нам тэги
-- они объединяются в один объект (MultiLineString)
lines as (
select st_union(way) way
from rd_line
where
highway in ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary',
import requests
import bz2
from time import sleep
def overpass2bz2(request, filename):
resp = requests.get('https://overpass-api.de/api/interpreter', data={'data': u"""[out:xml][timeout:180];(%s);(._;>;);out meta;""" % request}, raw_response=True)
sleep(15)
if resp.status_code != 200:
print resp.status_code, resp.reason