Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
6e908aeb
Commit
6e908aeb
authored
Nov 13, 2019
by
Stefan Schuhbaeck
Browse files
add area of interest switch to osm2vadere tool.
parent
99837cfd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Tools/Converters/osm2vadere/osm2vadere.py
View file @
6e908aeb
...
...
@@ -151,7 +151,8 @@ class OsmConverter:
def
from_args
(
cls
,
arg
):
c
=
cls
(
arg
.
input
,
arg
.
use_osm_id
)
c
.
filter
()
c
.
filter_area_of_interest
()
if
arg
.
use_aoi
:
c
.
filter_area_of_interest
()
return
c
@
staticmethod
...
...
@@ -499,6 +500,15 @@ def parse_command_line_arguments():
default
=
True
,
help
=
"Set to use osm ids for obstacles"
)
convert_parser
.
add_argument
(
"--use-aoi"
,
dest
=
'use_aoi'
,
type
=
str2bool
,
const
=
True
,
nargs
=
"?"
,
default
=
False
,
help
=
"Set to reduce export to elements within an area of interest. "
"(way taged with vadere:area-of-intrest) "
)
convert_parser
.
set_defaults
(
main_func
=
main_convert
)
cmd_args
=
main
.
parse_args
()
...
...
Tools/Converters/osm2vadere/osm_helper.py
View file @
6e908aeb
...
...
@@ -808,6 +808,12 @@ class OsmData:
lon
=
[
0
,
0
]
nodes
=
[
self
.
lookup
.
node_to_latlon
[
int
(
id
)]
for
id
in
self
.
xml
.
xpath
(
"/osm/way[./tag/@k='vadere:area-of-intrest']/nd/@ref"
)][:
-
1
]
if
len
(
nodes
)
==
0
:
raise
RuntimeError
(
f
"No area of interst found. Map does not contain a way with the tag 'vadere:area-of-intrest'"
)
elif
len
(
nodes
)
<
2
:
raise
RuntimeError
(
f
"area-of-intrest path contains only '
{
len
(
nodes
)
}
' nodes. Need at least 3 nodes to "
f
"create area of interest."
)
node_lat
=
[
n
[
0
]
for
n
in
nodes
]
node_lon
=
[
n
[
1
]
for
n
in
nodes
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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