Crossroads segmentation is a python tool that produces automatic segmentations of data from OpenStreetMap.
Project description
crossroads segmentation
Crossroads segmentation is a python tool that produces automatic segmentations of data from OpenStreetMap.
Installation
Using pip, use the following command line to install crseg:
pip install crossroad-segmentation
Dependancies
Examples
The main example to use is examples/get-crossroad-description.py
. You will find a complete description of the possible parameters using the following command:
PYTHONPATH=$PWD examples/get-crossroad-description.py --help
This tool is using OSMnx to download OpenStreetMap data from the selected region. It uses a cache, stored in cache/
directory. If a region has already been asked, it will use the cached data and not download it again. You can of course delete the cache directory to download again the data.
The location of the region can be choosen using coordinates (--by-coordinates LAT LNG
) or using an predefined coordinate defined by a name (--by-name NAME
). A radius (-r VALUE
) with a default value of 150 meters can be adjusted to choose the size of the region to consider.
Several outputs are possible:
-
to display the segmentation with all the crossings in the region (
--display-segmentation
), or only focussing on the main crossroad (--display-main-crossroad
) closest to the input coordinate. This second display gives also the branches of the crossroad. -
to produce a text version of the selection (
--to-text
,--to-text-all
) in the standard output -
to produce a
json
file that contains all the detected crossroads (--to-json-all FILENAME
) or only the main one (--to-json FILENAME
). Branches are also contained in this output. -
3 parameters (C0, C1 and C2) to drive the creation and merge of the crossroads
-
a maximum number of crossroads in a ring (
--max-cycle-elements NB
), with default value of 10 for the last step of the segmentation.
Several of these outputs (--to-json
, --to-json-all
, --display-main-crossroad
, --to-geopackage
) can be adjusted using the parameter --multiscale
to describe the small crossroad that has been merged to produce the large ones.
Non regression tests
A very basic non regression test is provided in test
directory. Usage:
- run first
./regenerate_references.sh
- run
./test.sh
each time you want to check for regressions
Visual evaluation
A separated project is available to evaluate segmentation quality. See crossroads-evaluation.
Examples
./get-crossroad-description.py --by-name POC1 --display-main-crossroad --multiscale
./get-crossroad-description.py --by-name obélisque --display-segmentation -r 1000
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for crossroads-segmentation-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3db80296fbdfc128327f3c3df465afd5e10748da769e686e60e6a12ecbc909db |
|
MD5 | a4626c3228110133a611b3f6f8f0307e |
|
BLAKE2b-256 | 9eacfd67dbbf9706a58c3cec5c26f57d723f56698a31b4d2d2136264968ae402 |
Hashes for crossroads_segmentation-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2a88f81b6bc6b2d69babad9c018fb56c18c90a5dd034981b5ddf967d560b2e8 |
|
MD5 | 8512cdbfae602664f63a9b6123c4bd58 |
|
BLAKE2b-256 | e1dafe22a14694b3e63e2890d6a28ef0ac5467a2810644688d2d0f073d34bf8f |