Skip to main content

Lib to convert Overture data in GIS formats and upload it to HDX

Project description

Overture Map Data 2 HDX

This project is designed to export geographic data from Overture Maps and upload it to the Humanitarian Data Exchange (HDX). The data is processed using DuckDB and can be exported in various formats such as GeoJSON, GPKG, and ESRI Shapefile.

Features

  • Export geographic data from Overture Maps.
  • Upload data to HDX.
  • Support for multiple output formats.
  • Configurable via YAML and environment variables.
  • Logging setup using environment variables or parameters.

Installation

pip install overture2hdx

Configuration

The application is configured using a YAML file and environment variables.

YAML Configuration

Example config.yaml:

iso3: npl
geom: '{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {}, "geometry": {"coordinates": [[]], "type": "Polygon"}}]}'
key: osgeonepal_pkr
subnational: true
frequency: yearly
categories:
- Roads:
    select:
        - id
        - names.primary as name
        - class as class
        - subclass as subclass
        - UNNEST(JSON_EXTRACT(road_surface, '$[*].value')) as road_surface
        - UNNEST(JSON_EXTRACT(sources, '$[*].dataset')) AS source
    hdx:
        title: Roads of Pokhara
        notes: Overturemaps Export for Pokhara. Data might have errors but has gone through validation checks.
        tags:
        - geodata
        - transportation
        - roads
    theme:
        - transportation
    feature_type:
        - segment
    formats:
        - gpkg
        - shp

Code Overview

Config: Class to handle configuration. OvertureMapExporter: Class to handle the export process. setup_logging: Function to set up logging.

Example

import json

geom = json.dumps(
    {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "properties": {},
                "geometry": {
                    "coordinates": [
                        [
                            [83.98047393581618, 28.255338988044088],
                            [83.973540694181, 28.230486421513703],
                            [83.91927014759125, 28.214265947308945],
                            [83.97832224013575, 28.195093119231174],
                            [83.96971545741735, 28.158212628626416],
                            [84.00175181531534, 28.19361814379657],
                            [84.03187555483152, 28.168540447741847],
                            [84.01059767533235, 28.208788347541898],
                            [84.0342663278089, 28.255549578267903],
                            [83.99960011963498, 28.228801292171724],
                            [83.98047393581618, 28.255338988044088],
                        ]
                    ],
                    "type": "Polygon",
                },
            }
        ],
    }
)
config_yaml_mini = f"""
    iso3: npl
    geom: {geom}
    key: osgeonepal_pkr
    subnational: true
    frequency: yearly
    categories:
    - Roads:
        select:
            - id
            - names.primary as name
            - class as class
            - subclass as subclass
            - UNNEST(JSON_EXTRACT(road_surface, '$[*].value')) as road_surface
            - UNNEST(JSON_EXTRACT(sources, '$[*].dataset')) AS source
        hdx:
            title: Roads of Pokhara Nepal
            notes:  Overturemaps Export for Pokhara . Data might known to have errors however gone through validation checks to detect map errors, breakage, and vandalism . Sources would be combination of OSM and Other openly available datasets in the region including facebook roads and ESRI community datasets
            tags:
            - geodata
            - transportation
            - roads
        theme:
            - transportation
        feature_type:
            - segment
        formats:
            - gpkg
            - shp

    - Buildings:
        select:
            - id
            - names.primary as name
            - class as class
            - subtype as subtype
            - height as height
            - level as level
            - num_floors as num_floors
            - UNNEST(JSON_EXTRACT(sources, '$[*].dataset')) AS source
        hdx:
            title: Buildings of Pokhara Nepal
            notes:  Overturemaps Export for Nepal . Data might known to have errors however gone through validation checks to detect map errors, breakage, and vandalism . Sources would be combination of OSM and Other openly available datasets in the region including facebook roads and ESRI community datasets
            tags:
            - geodata
        theme:
            - buildings
        feature_type:
            - building
        formats:
            - gpkg
            - shp
    """


from overture2hdx import Config, Exporter

config = Config(config_yaml=config_yaml_mini)
exporter = Exporter(config)
results = exporter.export()
print(results)

Author and License

Kshitij Raj Sharma , License : GNU GENERAL PUBLIC LICENSE V3

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

overture2hdx-0.0.3.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

overture2hdx-0.0.3-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file overture2hdx-0.0.3.tar.gz.

File metadata

  • Download URL: overture2hdx-0.0.3.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for overture2hdx-0.0.3.tar.gz
Algorithm Hash digest
SHA256 07cee4ecdb1897d4e21fee69870ad057dbafc83241a888250e439ecb2ef1c867
MD5 0ab5939057364bfadf935f8f72c0929a
BLAKE2b-256 bf52634141587363c4a20c8547217eacf2667134abcc8f5e56b7cf149ae282fa

See more details on using hashes here.

File details

Details for the file overture2hdx-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for overture2hdx-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 90966a3d4a644889cb660c2b42095009273afdba4e706d5f0fc3368c28762b6e
MD5 7a330a98278143cfd46f93961fc9e829
BLAKE2b-256 1ecf6961ce520d548bbe4993d805b30aca4f9a18145b0f4aa383da9dce0b9c83

See more details on using hashes here.

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