Skip to content

Commit

Permalink
Merge pull request #1946 from tilezen/release-v1.8
Browse files Browse the repository at this point in the history
Merge changes from release 1.8 branch to master
  • Loading branch information
iandees authored Jan 29, 2021
2 parents e47198d + cdeb2b2 commit 024909e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 18 deletions.
14 changes: 13 additions & 1 deletion data/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ DECLARE
-- station node, way or relation passed as input.
seed_relations bigint[];

-- the geometry of the passed in OSM object, used to limit the
-- station_and_stops query
origin_point geometry;

-- IDs of nodes which are tagged as stations or stops and are
-- members of the stop area relations. these will contain the
-- original `station_node_id`, but probably many others as well.
Expand Down Expand Up @@ -422,6 +426,13 @@ BEGIN
NOT cycle
) SELECT id FROM downward_search WHERE NOT cycle);

-- get the geometry for the passed-in OSM object. we'll use this to
-- limit the stations and stops collected in the next step
origin_point := COALESCE(
(SELECT way FROM planet_osm_point WHERE osm_id = station_point_osm_id),
(SELECT ST_PointOnSurface(way) FROM planet_osm_polygon WHERE osm_id = station_polygon_osm_id)
);

-- collect all the interesting nodes - this includes the station node (if
-- any) and any nodes which are members of found relations which have
-- public transport tags indicating that they're stations or stops.
Expand All @@ -435,7 +446,8 @@ BEGIN
ON n.id = p.osm_id
WHERE
(p.tags->'railway' IN ('station', 'stop', 'tram_stop') OR
p.tags->'public_transport' IN ('stop', 'stop_position', 'tram_stop'))
p.tags->'public_transport' IN ('stop', 'stop_position', 'tram_stop')) AND
ST_DWithin(p.way, origin_point, 1000)
-- re-include the station node, if there was one.
UNION
SELECT station_point_osm_id AS id
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- This index is used to improve performance of mz_calculate_transit_routes_and_score
CREATE INDEX
planet_osm_rels_parts_interesting_transit_relation
ON planet_osm_rels USING gin(parts)
WHERE
mz_is_interesting_transit_relation(hstore(tags));
6 changes: 6 additions & 0 deletions data/indexes/planet_osm_ways_nodes_railway_index.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- This index is used to improve performance of mz_calculate_transit_routes_and_score
CREATE INDEX
planet_osm_ways_nodes_railway
ON planet_osm_ways USING gin(nodes)
WHERE
hstore(tags)->'railway' IN ('subway', 'light_rail', 'tram', 'rail');
4 changes: 2 additions & 2 deletions integration-test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def parse_layer_dict(yaml_path, output_fn, fn_name_fn):
layer_parse_result = parse_layers(yaml_path, output_fn, fn_name_fn)

layers = {}
for l in layer_parse_result.layer_data:
layers[l.layer] = l.fn
for layer_data in layer_parse_result.layer_data:
layers[layer_data.layer] = layer_data.fn

return layers

Expand Down
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edtf==2.6.0
future==0.16.0
gunicorn==19.9.0
hiredis==0.2.0
lxml==4.1.1
lxml==4.6.2
mapbox-vector-tile==1.2.0
ModestMaps==1.4.7
protobuf==3.4.0
Expand All @@ -16,13 +16,15 @@ pycountry==17.9.23
python-dateutil==2.6.1
PyYAML==4.2b4
redis==2.10.6
setuptools<=44.1.1 ## Last version to support py2
Shapely==1.6.2.post1
simplejson==3.12.0
six==1.11.0
StreetNames==0.1.5
tqdm==4.31.1
urllib3==1.24.3 ## REMOVE THIS AS SOON AS botocore ALLOWS >=1.25
Werkzeug==0.12.2
urllib3==1.25.11
webcolors<=1.11 ## Last version to support py2
Werkzeug<=0.16.1
wsgiref==0.1.2
git+https://github.com/tilezen/tilequeue@master#egg=tilequeue
git+https://github.com/tilezen/tileserver@master#egg=tileserver
Expand Down
18 changes: 9 additions & 9 deletions vectordatasource/meta/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,20 @@ def parse_sum(ast_state, orig):
}


def parse_lookup(ast_state, l):
assert isinstance(l, dict)
assert set(l.keys()) >= set(('key', 'op', 'table'))
def parse_lookup(ast_state, lookup):
assert isinstance(lookup, dict)
assert set(lookup.keys()) >= set(('key', 'op', 'table'))

key = ast_value(ast_state, l['key'])
key = ast_value(ast_state, lookup['key'])

# only support >=, <= for now
assert l['op'] in _KNOWN_OPS, '%r is not one of %r known binary ' \
'operators' % (l['op'], _KNOWN_OPS.keys())
op = _KNOWN_OPS[l['op']]()
assert lookup['op'] in _KNOWN_OPS, '%r is not one of %r known binary ' \
'operators' % (lookup['op'], _KNOWN_OPS.keys())
op = _KNOWN_OPS[lookup['op']]()

default = ast_value(ast_state, l.get('default'))
default = ast_value(ast_state, lookup.get('default'))

table = l['table']
table = lookup['table']
assert isinstance(table, list)

expr = default
Expand Down
6 changes: 3 additions & 3 deletions vectordatasource/meta/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,11 @@ def visit_IfExp(self, ifexp):

self.buf.write(" END)")

def visit_List(self, l):
def visit_List(self, the_list):
if self.in_json:
self.buf.write("('[")
first = True
for elt in l.elts:
for elt in the_list.elts:
if first:
first = False
else:
Expand All @@ -456,7 +456,7 @@ def visit_List(self, l):
else:
self.buf.write("ARRAY[")
first = True
for elt in l.elts:
for elt in the_list.elts:
if first:
first = False
else:
Expand Down

0 comments on commit 024909e

Please sign in to comment.