xplane-apt-convert


Namexplane-apt-convert JSON
Version 0.5.6 PyPI version JSON
download
home_page
SummaryConvert X-Plane airport data to GIS-friendly formats like GeoJSON or ESRI Shapefile.
upload_time2024-02-24 10:36:03
maintainer
docs_urlNone
author
requires_python>=3.6
licenseMIT
keywords geojson gis geopackage airport shapefile ogr airports fiona xplane geobuf gpkg flatgeobuf
VCS
bugtrack_url
requirements bezier fiona numpy rich typer xplane_airports
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # X-Plane apt.dat convert

<a href="https://pypi.org/project/xplane-apt-convert/" target="_blank">
    <img src="https://img.shields.io/pypi/v/xplane_apt_convert.svg" alt="Package version">
</a>
<a href="https://pypi.org/project/xplane-apt-convert/" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/xplane_apt_convert.svg" alt="Supported Python versions">
</a>
<a href="https://pypi.org/project/xplane-apt-convert/" target="_blank">
    <img src="https://img.shields.io/pypi/wheel/xplane_apt_convert.svg" alt="Wheel support">
</a>
<a href="https://pypi.org/project/xplane-apt-convert/" target="_blank">
    <img src="https://img.shields.io/pypi/l/xplane_apt_convert.svg" alt="License">
</a>

`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](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/example_LEBL.png)](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/example_LEBL.png)


## Input

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

- Load a local `apt.dat` file.
- Automatically download airport-specific files from the [X-Plane Scenery Gateway](https://gateway.x-plane.com/).

**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:

```console
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:

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

And then try installing `xplane_apt_convert` again.

See [dhermes/bezier/issues/283](https://github.com/dhermes/bezier/issues/283) for more details about this issue.


## CLI Basic Usage

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

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


Convert multiple airports:

```console
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:

```console
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](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/cli_help.svg)](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/cli_help.svg)


## Python Basic Usage

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

```python
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:

```python
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](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "xplane-apt-convert",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "geojson,gis,geopackage,airport,shapefile,ogr,airports,fiona,xplane,geobuf,gpkg,flatgeobuf",
    "author": "",
    "author_email": "Carlos Bergillos <c.bergillos.v@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/2d/ee/f29b2e6502ff7fbffbc51471158991424b8ed4b31f3122dbc52b117cca34/xplane_apt_convert-0.5.6.tar.gz",
    "platform": null,
    "description": "# X-Plane apt.dat convert\n\n<a href=\"https://pypi.org/project/xplane-apt-convert/\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/v/xplane_apt_convert.svg\" alt=\"Package version\">\n</a>\n<a href=\"https://pypi.org/project/xplane-apt-convert/\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/pyversions/xplane_apt_convert.svg\" alt=\"Supported Python versions\">\n</a>\n<a href=\"https://pypi.org/project/xplane-apt-convert/\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/wheel/xplane_apt_convert.svg\" alt=\"Wheel support\">\n</a>\n<a href=\"https://pypi.org/project/xplane-apt-convert/\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/l/xplane_apt_convert.svg\" alt=\"License\">\n</a>\n\n`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.\n\n[![Example LELL airport layout](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/example_LEBL.png)](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/example_LEBL.png)\n\n\n## Input\n\nX-Plane `apt.dat` files are used as input.\nTwo input modes exist:\n\n- Load a local `apt.dat` file.\n- Automatically download airport-specific files from the [X-Plane Scenery Gateway](https://gateway.x-plane.com/).\n\n**Note:** Only tested with `apt.dat` files version 1100.\n\n\n## Output\n\nThe following output formats are supported:\n\n| Format                     | Extension   |\n| :------------------------- | :---------- |\n| ESRI Shapefile             | `.shp`      |\n| FlatGeobuf                 | `.fgb`      |\n| GeoJSON                    | `.geojson`  |\n| GeoJSON lines (GeoJSONSeq) | `.geojsonl` |\n| GeoPackage (GPKG)          | `.gpkg`     |\n| GML                        | `.gml`      |\n| OGR_GMT                    | `.gmt`      |\n| SQLite                     | `.sqlite`   |\n\n\n## Supported Features\n\nThe following airport features are supported:\n\n- **Windsocks** (row code `19`)\n- **Ground signs** (row code `20`)\n- **Runways** (row code `100`)\n- **Pavement areas (taxiway and aprons)** (header row code `110`)\n- **Ground markings (linear features)** (header row code `120`)\n- **Airport boundary** (header row code `130`)\n- **Aircraft startup locations (parking and gates)** (row code `1300`)\n- **Airport metadata** (row code `1302`)\n\n\n## Installation\n\nThe `xplane_apt_convert` Python package can be installed using pip:\n\n```console\npip install xplane_apt_convert\n```\n\n**Python 3.10 and above**\n\nWhen using Python 3.10 and above, you might encounter the following error during the installation of the `bezier` dependency:\n`The BEZIER_INSTALL_PREFIX environment variable must be set.`\n\nTo solve it, you can install the pure Python version of the `bezier` package by running:\n\n```console\nBEZIER_NO_EXTENSION=true pip install bezier --no-binary=bezier\n```\n\nAnd then try installing `xplane_apt_convert` again.\n\nSee [dhermes/bezier/issues/283](https://github.com/dhermes/bezier/issues/283) for more details about this issue.\n\n\n## CLI Basic Usage\n\nConvert an airport in a local `apt.dat` file to GeoJSON:\n\n```console\npython -m xplane_apt_convert -a LEBL -i ./apt.dat -o ./out/ -d GeoJSON\n```\n\n\nConvert multiple airports:\n\n```console\npython -m xplane_apt_convert -a LEBL,LEGE,LERS,LELL -i ./apt.dat -o ./out/ -d GeoJSON\n```\n\n\nDownload the recommended airport data files from the X-Plane Scenery Gateway and convert them:\n\n```console\npython -m xplane_apt_convert -a LEBL,LEGE,LERS,LELL -g -o ./out/ -d GeoJSON\n```\n\nOther output file formats are available using the `-d` option, for example `GeoJSON`, `ESRI Shapefile`, or `GPKG`.\n\nFor information about all available options run the command using `--help`.\n\n[![CLI help](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/cli_help.svg)](https://raw.githubusercontent.com/CarlosBergillos/xplane_apt_convert/main/images/cli_help.svg)\n\n\n## Python Basic Usage\n\nConvert an airport in a local `apt.dat` file to GeoJSON:\n\n```python\nfrom xplane_airports.AptDat import AptDat\nfrom xplane_apt_convert import ParsedAirport\n\ninput_file = \"./apt.dat\"\nairport_id = \"LEBL\"\n\nwith open(input_file, \"r\") as f:\n    apt_dat = AptDat.from_file_text(f.read(), input_file)\n\napt = apt_dat.search_by_id(airport_id)\n\np_apt = ParsedAirport(apt)\np_apt.export(\"./airport.geojson\")\n```\n\n\nDownload an airport from the X-Plane Scenery Gateway and convert it to ESRI Shapefile:\n\n```python\nfrom xplane_airports.gateway import scenery_pack\nfrom xplane_apt_convert import ParsedAirport\n\nairport_id = \"LEBL\"\n\nrecommended_pack = scenery_pack(airport_id)\napt = recommended_pack.apt\n\np_apt = ParsedAirport(apt)\np_apt.export(\"./airport.shp\", driver=\"ESRI Shapefile\")\n```\n\nSee the function's docstring for more information on all the allowed arguments.\n\n\n## License\n\nThis software is licensed under the terms of the [MIT License](LICENSE).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convert X-Plane airport data to GIS-friendly formats like GeoJSON or ESRI Shapefile.",
    "version": "0.5.6",
    "project_urls": {
        "Source Code": "https://github.com/CarlosBergillos/xplane_apt_convert"
    },
    "split_keywords": [
        "geojson",
        "gis",
        "geopackage",
        "airport",
        "shapefile",
        "ogr",
        "airports",
        "fiona",
        "xplane",
        "geobuf",
        "gpkg",
        "flatgeobuf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9558012e5f3a274d3882f916896f8db2af88fd99b4545dbb5cdb8627f5b63afc",
                "md5": "a3be3d70163f1abe655403cc94f261b0",
                "sha256": "cb04966715c8c1942f81b3ebdba1d4ae41f197044ac45fbe6bdce69b5d4c63ff"
            },
            "downloads": -1,
            "filename": "xplane_apt_convert-0.5.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a3be3d70163f1abe655403cc94f261b0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 15618,
            "upload_time": "2024-02-24T10:36:02",
            "upload_time_iso_8601": "2024-02-24T10:36:02.178665Z",
            "url": "https://files.pythonhosted.org/packages/95/58/012e5f3a274d3882f916896f8db2af88fd99b4545dbb5cdb8627f5b63afc/xplane_apt_convert-0.5.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2deef29b2e6502ff7fbffbc51471158991424b8ed4b31f3122dbc52b117cca34",
                "md5": "6dfc15eee13952dc047a91ab77c51db9",
                "sha256": "a4a79aa720a85b46c2c19a9666180dfdb666fd2d8ba10c3085f4de6bbf4b9960"
            },
            "downloads": -1,
            "filename": "xplane_apt_convert-0.5.6.tar.gz",
            "has_sig": false,
            "md5_digest": "6dfc15eee13952dc047a91ab77c51db9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 15559,
            "upload_time": "2024-02-24T10:36:03",
            "upload_time_iso_8601": "2024-02-24T10:36:03.939186Z",
            "url": "https://files.pythonhosted.org/packages/2d/ee/f29b2e6502ff7fbffbc51471158991424b8ed4b31f3122dbc52b117cca34/xplane_apt_convert-0.5.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-24 10:36:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "CarlosBergillos",
    "github_project": "xplane_apt_convert",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "bezier",
            "specs": []
        },
        {
            "name": "fiona",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "rich",
            "specs": []
        },
        {
            "name": "typer",
            "specs": []
        },
        {
            "name": "xplane_airports",
            "specs": []
        }
    ],
    "lcname": "xplane-apt-convert"
}
        
Elapsed time: 0.18977s