Skip to main content

Convert X-Plane airport data to GIS-friendly formats like GeoJSON or ESRI Shapefile.

Project description

X-Plane apt.dat convert

Package version Supported Python versions Wheel support License

xplane_apt_convert is a Python package and CLI application allowing to convert X-Plane airport data to GIS-friendly formats like GeoJSON or ESRI Shapefile.

Example LELL airport layout

Input

X-Plane apt.dat files are used as input. Two input modes exist:

Note: Only tested with apt.dat files version 1100.

Output

The following output formats are supported:

Format Extension
ESRI Shapefile .shp
FlatGeobuf .fgb
GeoJSON .geojson
GeoJSON lines (GeoJSONSeq) .geojsonl
GeoPackage (GPKG) .gpkg
GML .gml
OGR_GMT .gmt
SQLite .sqlite

Supported Features

The following airport features are supported:

  • Windsocks (row code 19)
  • Ground signs (row code 20)
  • Runways (row code 100)
  • Pavement areas (taxiway and aprons) (header row code 110)
  • Ground markings (linear features) (header row code 120)
  • Airport boundary (header row code 130)
  • Aircraft startup locations (parking and gates) (row code 1300)
  • Airport metadata (row code 1302)

Installation

The xplane_apt_convert Python package can be installed using pip:

pip install xplane_apt_convert

Python 3.10 and above

When using Python 3.10 and above, you might encounter the following error during the installation of the bezier dependency: The BEZIER_INSTALL_PREFIX environment variable must be set.

To solve it, you can install the pure Python version of the bezier package by running:

BEZIER_NO_EXTENSION=true pip install bezier --no-binary=bezier

And then try installing xplane_apt_convert again.

See dhermes/bezier/issues/283 for more details about this issue.

CLI Basic Usage

Convert an airport in a local apt.dat file to GeoJSON:

python -m xplane_apt_convert -a LEBL -i ./apt.dat -o ./out/ -d GeoJSON

Convert multiple airports:

python -m xplane_apt_convert -a LEBL,LEGE,LERS,LELL -i ./apt.dat -o ./out/ -d GeoJSON

Download the recommended airport data files from the X-Plane Scenery Gateway and convert them:

python -m xplane_apt_convert -a LEBL,LEGE,LERS,LELL -g -o ./out/ -d GeoJSON

Other output file formats are available using the -d option, for example GeoJSON, ESRI Shapefile, or GPKG.

For information about all available options run the command using --help.

CLI help

Python Basic Usage

Convert an airport in a local apt.dat file to GeoJSON:

from xplane_airports.AptDat import AptDat
from xplane_apt_convert import ParsedAirport

input_file = "./apt.dat"
airport_id = "LEBL"

with open(input_file, "r") as f:
    apt_dat = AptDat.from_file_text(f.read(), input_file)

apt = apt_dat.search_by_id(airport_id)

p_apt = ParsedAirport(apt)
p_apt.export("./airport.geojson")

Download an airport from the X-Plane Scenery Gateway and convert it to ESRI Shapefile:

from xplane_airports.gateway import scenery_pack
from xplane_apt_convert import ParsedAirport

airport_id = "LEBL"

recommended_pack = scenery_pack(airport_id)
apt = recommended_pack.apt

p_apt = ParsedAirport(apt)
p_apt.export("./airport.shp", driver="ESRI Shapefile")

See the function's docstring for more information on all the allowed arguments.

License

This software is licensed under the terms of the MIT License.

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

xplane_apt_convert-0.5.6.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

xplane_apt_convert-0.5.6-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file xplane_apt_convert-0.5.6.tar.gz.

File metadata

  • Download URL: xplane_apt_convert-0.5.6.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for xplane_apt_convert-0.5.6.tar.gz
Algorithm Hash digest
SHA256 a4a79aa720a85b46c2c19a9666180dfdb666fd2d8ba10c3085f4de6bbf4b9960
MD5 6dfc15eee13952dc047a91ab77c51db9
BLAKE2b-256 2deef29b2e6502ff7fbffbc51471158991424b8ed4b31f3122dbc52b117cca34

See more details on using hashes here.

File details

Details for the file xplane_apt_convert-0.5.6-py3-none-any.whl.

File metadata

File hashes

Hashes for xplane_apt_convert-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cb04966715c8c1942f81b3ebdba1d4ae41f197044ac45fbe6bdce69b5d4c63ff
MD5 a3be3d70163f1abe655403cc94f261b0
BLAKE2b-256 9558012e5f3a274d3882f916896f8db2af88fd99b4545dbb5cdb8627f5b63afc

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