GithubHelp home page GithubHelp logo

carlosbergillos / xplane_apt_convert Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 2.0 1.73 MB

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

License: MIT License

Python 100.00%
airport airports fiona flatgeobuf geobuf geojson geopackage gis gpkg ogr

xplane_apt_convert's Introduction

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.

xplane_apt_convert's People

Contributors

carlosbergillos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xplane_apt_convert's Issues

May I ask why an error occurred?

[16:25:31] INFO Parsing airport.
[16:25:31] WARNING Unknown value 106 found for LineType.
[16:25:31] WARNING Unknown value 101 found for LineType.
[16:25:31] WARNING Unknown value 105 found for LineType.
[16:25:31] WARNING Unknown value 104 found for LineType.
[16:25:31] WARNING Unknown value 22 found for LineLightingType.
[16:25:31] WARNING Unknown value 103 found for LineType.
[16:25:31] INFO Writing boundary.
[16:25:31] INFO Writing runways.
[16:25:31] WARNING Normalized/laundered field name: 'surface_type' to 'surface_ty'
[16:25:31] WARNING Normalized/laundered field name: 'shoulder_surface_type' to 'shoulder_s'
[16:25:31] WARNING Normalized/laundered field name: 'centerline_lights' to 'centerline'
[16:25:31] WARNING Normalized/laundered field name: 'edge_lights' to 'edge_light'
[16:25:31] WARNING Normalized/laundered field name: 'auto_distance_remaining_signs' to 'auto_dista'
[16:25:31] WARNING Normalized/laundered field name: 'dthr_length_1' to 'dthr_lengt'
[16:25:31] WARNING Normalized/laundered field name: 'dthr_length_2' to 'dthr_len_1'
[16:25:31] WARNING Normalized/laundered field name: 'overrun_length_1' to 'overrun_le'
[16:25:31] WARNING Normalized/laundered field name: 'overrun_length_2' to 'overrun__1'
[16:25:31] WARNING Normalized/laundered field name: 'tdz_lighting_1' to 'tdz_lighti'
[16:25:31] WARNING Normalized/laundered field name: 'tdz_lighting_2' to 'tdz_ligh_1'
[16:25:31] INFO Writing startup_locations.
[16:25:31] WARNING Normalized/laundered field name: 'location_type' to 'location_t'
[16:25:31] WARNING Normalized/laundered field name: 'airplane_types' to 'airplane_t'
[16:25:31] INFO Writing windsocks.
[16:25:31] WARNING Normalized/laundered field name: 'illuminated' to 'illuminate'
[16:25:31] INFO Writing signs.
[16:25:32] INFO Writing pavements.
[16:25:32] WARNING Normalized/laundered field name: 'surface_type' to 'surface_ty'
[16:25:32] WARNING Normalized/laundered field name: 'texture_orientation' to 'texture_or'
[16:25:32] INFO Writing linear_features.
[16:25:32] WARNING Normalized/laundered field name: 'painted_line_type' to 'painted_li'
[16:25:32] WARNING Normalized/laundered field name: 'lighting_line_type' to 'lighting_l'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.