Skip to main content

A CLI tool to render GeoJSON data using Jinja2 templates.

Project description

This project is a GeoJSON template renderer that processes GeoJSON files and applies Jinja2 templates to generate customized output. It supports:

  • Processing single or multiple GeoJSON files

  • Grouping features dynamically

  • Custom Jinja2 filters for feature property updates

  • Command-line interface (CLI) support

Installation

Prerequisites

  1. Python 3.x

  2. pip package manager

Install Dependencies

To install production dependencies:

make install

To install development dependencies (for testing and linting):

make install-dev

Usage

Running the Script:

python main.py <input_path> <template_path> --output <output_file>

Arguments:

input_path: Path to a GeoJSON file or a directory containing multiple GeoJSON files:

template_path: Path to the Jinja2 template file.

–output <output_file> (optional): Path to save the rendered output. If omitted, output is printed to stdout.

Example Command::

python main.py geojson_data/ templates/output.jinja --output result.geojson

Filters

dict_update: Updates a dictionary with new key-value pairs, returns the updated dictionary.

dict_update_if: Updates a dictionary with new key-value pairs if a condition (specified key contains the value) is met, returns the updated dictionary.

compile_description: Compiles a description string wrapping Name property into a URL property and also adding Img tags for Images property

Development

Running Tests:

make test

Running Tests with Coverage:

make test-coverage

Linting Code:

make lint

License

This project is licensed under the MIT License. Contact the author https://github.com/krvss for more information.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geojson_composer-0.1.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file geojson_composer-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for geojson_composer-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a30efafb1f9b3556ec2f5697d70f510e2fc019871b8f5f8f4bdc4d4ed9c32629
MD5 0f193768639b25560c67b56cc70c3b89
BLAKE2b-256 a2970e9d864c5db6b8d6220abb9c9b51e78342f21b6c4556da5ff46282024af9

See more details on using hashes here.

Supported by

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