Skip to main content

No project description provided

Project description

OTLMOW-Converter

PyPI otlmow-converter-downloads Unittests PyPI - Python Version GitHub issues coverage

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otlmow_converter-0.11.1.tar.gz (56.9 kB view hashes)

Uploaded Source

Built Distribution

otlmow_converter-0.11.1-py3-none-any.whl (58.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page