Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
ZHV Tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OPENER
ZHV Tools
Commits
c8c01251
Commit
c8c01251
authored
May 07, 2020
by
Thomas Graichen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consider false or missing data in ZHV
- we can even not rely on the existence of a DHID. Check this therefore.
parent
516fc858
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
10 deletions
+25
-10
zhv_parser/ZhvConverter.py
zhv_parser/ZhvConverter.py
+25
-10
No files found.
zhv_parser/ZhvConverter.py
View file @
c8c01251
...
...
@@ -6,9 +6,7 @@ from typing import Sequence
import
osmium
from
lxml
import
etree
from
osmium.osm
import
create_mutable_relation
,
create_mutable_node
from
osmium.osm
import
Location
from
osmium.osm._osm
import
RelationMember
from
osmium.osm.mutable
import
Relation
,
Node
from
zhv_parser
import
ZhvClasses
...
...
@@ -144,7 +142,7 @@ class ZhvConverter:
elif
elem
.
tag
==
tag_stop_place
and
action
==
event_end
:
if
len
(
list_stop_signs
)
==
0
:
return
None
return
None
,
None
else
:
# todo assign IDs of stop signs as members to stop place relation
for
stop_sign
in
list_stop_signs
:
...
...
@@ -173,7 +171,10 @@ class ZhvConverter:
quay_class
=
ZhvClasses
.
Quay
quay
=
quay_class
.
factory
()
quay
.
build
(
elem
)
list_nodes
.
append
(
self
.
quay_to_osm
(
quay
,
stop_sign_type
,
context
))
node
=
self
.
quay_to_osm
(
quay
,
stop_sign_type
,
context
)
if
node
is
not
None
:
list_nodes
.
append
(
node
)
elif
elem
.
tag
==
tag_area
and
action
==
event_end
:
return
list_nodes
...
...
@@ -181,16 +182,30 @@ class ZhvConverter:
""" Extract an OSM node from the given ZHV stop sign structure """
# extract quay parameters
# TODO: Ask ZHV: Why are names double encapsulated?
quay_name
:
str
=
quay
.
get_Name
().
get_Name
()[
0
].
get_valueOf_
()
quay_dhid
:
str
=
quay
.
get_DHID
()
quay_lat
:
str
=
quay
.
get_Location
().
get_Latitude
()
quay_lon
:
str
=
quay
.
get_Location
().
get_Longitude
()
node_stop_sign
:
Node
=
Node
()
try
:
quay_dhid
:
str
=
quay
.
get_DHID
()
if
quay_dhid
is
None
:
raise
ValueError
(
'No DHID set!'
)
quay_lat
:
str
=
quay
.
get_Location
().
get_Latitude
()
quay_lon
:
str
=
quay
.
get_Location
().
get_Longitude
()
node_stop_sign
.
location
=
Location
(
quay_lon
,
quay_lat
)
except
Exception
as
error
:
print
(
error
)
return
None
# todo exception handling
try
:
quay_name
:
str
=
quay
.
get_Name
().
get_Name
()[
0
].
get_valueOf_
()
node_stop_sign
.
tags
.
append
((
osm_tag_ref
[
0
],
quay_name
))
except
:
pass
node_stop_sign
.
id
=
self
.
get_unused_osm_id
()
node_stop_sign
.
location
=
Location
(
quay_lon
,
quay_lat
)
node_stop_sign
.
tags
=
list
()
node_stop_sign
.
tags
.
append
((
osm_tag_ref_ifopt
[
0
],
quay_dhid
))
node_stop_sign
.
tags
.
append
((
osm_tag_ref
[
0
],
quay_name
))
node_stop_sign
.
tags
.
append
(
osm_tag_platform_pt
)
node_stop_sign
.
tags
.
append
(
stop_sign_type
.
value
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment