Skip to main content

ili2ogc

A pure-Python INTERLIS 2 toolkit: parses .ili models into a graph of typed Python objects (the IlisMeta16 metamodel), validates .xtf data transfers against them, and converts both to JSON Schema, SQL DDL (PostgreSQL/ GeoPackage), OGC JSON-FG, CQL2-JSON filters, and back to .xtf. TRANSLATION OF models are supported throughout via --lang (renames identifiers/keys in the output, the transfer wire format itself is unaffected).

Installation

uv sync          # or: pip install .

The generated ANTLR lexer/parser are committed under src/interlis/antlr/, so no grammar build step is needed.

Usage

interlis fetch-models model.ili transfer.xtf -o models/                 # download the models they import
interlis build model.ili --repo models/                                 # parse + print the built model
interlis validate-xtf transfer.xtf --repo models/                       # check .xtf against its .ili schema
interlis convert-jsonschema model.ili -o model.schema.json             # .ili -> JSON Schema
interlis convert-sql model.ili --dialect postgresql -o model.sql        # .ili -> SQL DDL
interlis import-xtf transfer.xtf --model model.ili --repo models/ -o data.sql # .xtf -> INSERTs into that schema
interlis convert-jsonfg transfer.xtf --repo models/ -o out.jsonfg.json   # .xtf -> OGC JSON-FG
interlis validate-jsonfg out.jsonfg.json --model m.ili --repo models/ # check a JSON-FG file against the model
interlis convert-cql2 model.ili -o model.cql2.json                      # CONSTRAINT -> CQL2-JSON filters
interlis convert-sld symbology.ili --sign-xtf signs.xtf -o styles/      # GRAPHIC -> OGC SLD/SE
interlis write-xtf view-model.ili source.xtf -o view.xtf                # VIEW TOPIC data -> .xtf

--repo DIR (repeatable) resolves IMPORTS/schema references against a directory of .ili files; fetch-models is the only command that goes online, to fill such a directory. Run interlis <command> --help for every option. The former names convert, validate and import still work in this release and print a deprecation notice; they will be removed later.

Python API

from pathlib import Path
from interlis.runtime.parse import parse_file
from interlis.builder.model_builder import InterlisModelBuilder
from interlis.xtf.parse import parse_xtf
from interlis.xtf.validate import validate_transfer

tree, syntax_errors = parse_file(Path("model.ili"))
builder = InterlisModelBuilder(Path("mappings"), Path("spec/grammar/mapping"))
model = builder.build(tree)  # graph of Pydantic objects, e.g. model.Element[0].Name

transfer = parse_xtf(Path("transfer.xtf"))
issues = validate_transfer(transfer, symbol_table=builder.symbol_table)

interlis.convert.jsonschema/.sql/.jsonfg/.cql2/.xtf_writer expose the same conversions as the CLI's convert/convert-sql/convert-jsonfg/ convert-cql2/write-xtf. Pass a ModelRepository (interlis.builder.repository) to the builder to resolve IMPORTS against other local .ili models.

Development

uv run pytest                 # test suite
uv run ruff check src/ tests/ # lint (also enforced in CI)
uv run black src/ tests/      # format

CI (.github/workflows/ci.yml) runs ruff, black --check and the test suite on Python 3.10/3.12/3.14.

spec/grammar/mapping/*.yml and mappings/ilismeta16-*.yml (the IlisMeta16 metamodel) are the executable source of truth: InterlisModelBuilder is a generic engine driven by this data, not hand-written parsing code per grammar rule. Regenerating the vendored grammar under vendor/interlis-antlr4 is a maintainer-only step, needed only when that submodule changes.

Metadata

Release files for ili2ogc 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ili2ogc 0.7.0
File Size Uploaded
ili2ogc-0.7.0.tar.gz 451.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ili2ogc 0.7.0
File Interpreter ABI Platform
ili2ogc-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 951.4 kB

Release files / ili2ogc-0.7.0.tar.gz

Download URL ili2ogc-0.7.0.tar.gz
Size 451.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c083b51e49a9d6dcf017767ea631c78e84f11871ae923d009b94e07a22865f15
BLAKE2b-256 checksum
How to use checksums
16dbd76fe77f62c1383c07e03d65b8bc3bb33b95d436f170129b86f72d411424
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / ili2ogc-0.7.0-py3-none-any.whl

Download URL ili2ogc-0.7.0-py3-none-any.whl
Size 499.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57965004cc18aa7c929ceea9bfa299fd6069f094645094aa833b8e19fadbbc06
BLAKE2b-256 checksum
How to use checksums
c98325484d2e7a67dce5d53ca834372db2e54df3bf6debfc640087dbb26ec202
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page