Skip to content

bartvdbraak/azure-geocode-mapping

Repository files navigation

Cluster

azure-geocode-mapping is a Python package that generates a mapping of Azure regions to their display names and geocodes.

Installation

To install azure-geocode-mapping, you can use Poetry by running:

poetry install

Usage

First off, we need the input files to be created in the data directory:

./data.sh

You can generate the mapping by running the following command:

poetry run azure-geocode-mapping
# or
poetry run python -m geomapper.mapping

This will create a JSON file data/geo.mapping.json that contains the Azure region mapping.

You can also import the create_azure_mapping function from the geomapper.mapping module and use it in your own code:

from geomapper.mapping import create_azure_mapping

mapping = create_azure_mapping()

Data

This package uses two data files to generate the mapping:

  • data/azure-regions.json: a JSON file containing the list of Azure regions and their aliases.
  • data/azure-geocodes.xml: an XML file containing the list of Azure regions and their geocodes.

These files are generated by data.sh into the data/ directory. Examples of their structure is also mimicked in the files from test/data.

Tests

This package comes with a set of unit tests that can be run using pytest. To run the tests, install the dev dependencies by running:

poetry install --with test

Then, run the tests using:

pytest tests/

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for more information.

License

azure-geocode-mapping is distributed under the MIT License. See the LICENSE file for more information.