summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshat Tandon <akshat.tandon@research.iiit.ac.in>2016-07-23 14:00:18 (GMT)
committerAkshat Tandon <akshat.tandon@research.iiit.ac.in>2016-07-23 14:04:03 (GMT)
commit849f4bfbefcd42c2f43afc7f884252c91ed97365 (patch)
tree39176ec0c1d5c7231eea48fa11ffedf9092386f4
parentf995bb5a36b4f942a4315e512fd0d6a6245c64d0 (diff)
Fix KeyError: 'depth' in shp2osm script
After adding support for bathymetries , we were getting KeyError: 'depth' whenever we tried to generate tiles. This fix solves this bug. Reviewers: nienhueser, rahn Differential Revision: https://phabricator.kde.org/D2271
-rw-r--r--tools/shp2osm/polyshp2osm.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/shp2osm/polyshp2osm.py b/tools/shp2osm/polyshp2osm.py
index 9b88472..e81e6d4 100644
--- a/tools/shp2osm/polyshp2osm.py
+++ b/tools/shp2osm/polyshp2osm.py
@@ -116,6 +116,13 @@ def purpose(data):
if data['prim_purp'] in keys:
return keys[data['prim_purp']]
+def bathymetry_map(data):
+ elevation = 0
+ if 'depth' in data:
+ elevation = data['depth']
+ tag = [('marble:feature', 'bathymetry'), ('ele', elevation)]
+ return tag
+
def road_map(data):
keys = {
@@ -274,8 +281,9 @@ def feature_class(data):
'Claim': [('boundary', 'administrative'), ('admin_level', '4')],
'Airport': [('aeroway', 'aerodrome')],
'Date line': [('marble_line', 'date')],
- 'Bathymetry': [('marble:feature', 'bathymetry'), ('ele', data['depth'])]
+ 'Bathymetry': [(bathymetry_map,None)]
}
+
if 'featurecla' in data:
if data['featurecla'] in feat_dict:
feat_dict[data['featurecla']] += 1