No project description provided
Project description
OTLMOW-Converter
OTLMOW Project
This project aims to implement the Flemish data standard OTL (https://wegenenverkeer.data.vlaanderen.be/) in Python. It is split into different packages to reduce compatibility issues
- otlmow_model
- otlmow_modelbuilder
- otlmow_converter (you are currently looking at this package)
- otlmow_template
- otlmow_postenmapping
Installation and requirements
OTLMOW-Converter has two dependencies besides the standard Python libraries: pandas and openpyxl. It will be automatically installed when installing this library. Currently, you need at least Python version 3.8 to use this library.
To install the OTL MOW project into your Python project, use pip to install it:
pip install otlmow_converter
To upgrade an existing installation use:
pip install otlmow_converter --upgrade
Usage
The core functionality of this library is creating objects of otlmow_model by, either using helper functions or reading a DAVIE file. Then the user can manipulate the objects and finally export them to a valid DAVIE file that can be imported in the application.
In the following example 100 objects are created and exported to a csv file.
from otlmow_converter.OtlmowConverter import OtlmowConverter
from otlmow_model.Classes.Onderdeel.Camera import Camera
created_assets = []
for nr in range(1, 100):
d = {'toestand': 'in-gebruik', 'isPtz': (nr <= 50),
'assetId': {'identificator': f'camera_{nr}'}}
created_assets.append(Camera.from_dict(d))
converter = OtlmowConverter()
converter.create_file_from_assets(filepath=Path('new_cameras.csv'), list_of_objects=created_assets)
It's also possible to import objects from a file and export it to a different format.
from otlmow_converter.OtlmowConverter import OtlmowConverter
converter = OtlmowConverter()
created_assets = converter.create_assets_from_file(filepath=Path('new_cameras.csv'))
converter.create_file_from_assets(filepath=Path('new_cameras.json'), list_of_objects=created_assets)
Formats
The following file formats are supported in OtlmowConverter
File format | Read | Write | DAVIE compliant |
---|---|---|---|
CSV | Yes | Yes | Yes |
Excel | Yes | Yes | Yes |
JSON | Yes | Yes | Yes |
GEOJSON | Yes | Yes | Yes |
JSON-LD | Yes | Yes | No |
TTL | No | Yes | No |
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 otlmow_converter-0.11.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a89d9aed8cff5f80bc62a2f4b3d3d8f878506e3d3386f76c4c0988c0f6344f1 |
|
MD5 | b421dfcba3c9c0d7d84ad2f4d93d0160 |
|
BLAKE2b-256 | 07bddc28052cbb690467729d4bdc00ae438612f46dabf9699a0132b48a4b49d2 |