{"id":50766342,"url":"https://github.com/X-Plane/xplane_airports","last_synced_at":"2026-06-28T18:00:36.403Z","repository":{"id":40598704,"uuid":"156911053","full_name":"X-Plane/xplane_airports","owner":"X-Plane","description":"Python tools for manipulating X-Plane's apt.dat files \u0026 interfacing with the X-Plane Scenery Gateway API","archived":false,"fork":false,"pushed_at":"2021-02-04T20:07:30.000Z","size":243,"stargazers_count":48,"open_issues_count":3,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-11-29T01:28:27.479Z","etag":null,"topics":["airport","airport-data","flight-simulation","x-plane"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/X-Plane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-09T19:53:02.000Z","updated_at":"2025-11-21T06:21:51.000Z","dependencies_parsed_at":"2022-09-20T12:14:33.297Z","dependency_job_id":null,"html_url":"https://github.com/X-Plane/xplane_airports","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/X-Plane/xplane_airports","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-Plane%2Fxplane_airports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-Plane%2Fxplane_airports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-Plane%2Fxplane_airports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-Plane%2Fxplane_airports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/X-Plane","download_url":"https://codeload.github.com/X-Plane/xplane_airports/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/X-Plane%2Fxplane_airports/sbom","scorecard":{"id":152643,"data":{"date":"2025-08-11","repo":{"name":"github.com/X-Plane/xplane_airports","commit":"00259ab889d9c8e1af2f0be54e1ca7bd4b9ffe1f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T11:06:34.388Z","repository_id":40598704,"created_at":"2025-08-16T11:06:34.388Z","updated_at":"2025-08-16T11:06:34.388Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34898568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["airport","airport-data","flight-simulation","x-plane"],"created_at":"2026-06-11T14:01:24.521Z","updated_at":"2026-06-28T18:00:36.394Z","avatar_url":"https://github.com/X-Plane.png","language":"Python","funding_links":[],"categories":["Other Software Librares"],"sub_categories":["Python Language Plugin and Scripts"],"readme":"Tools for working with X-Plane airport data\n============================================================================================================================================================\n\n[![CircleCI](https://circleci.com/gh/X-Plane/xplane_airports/tree/main.svg?style=svg)](https://circleci.com/gh/X-Plane/xplane_airports/tree/main)\n\n`xplane_airports` is a Python package for interacting with [X-Plane](https://www.x-plane.com)'s airport data ([`apt.dat`](https://developer.x-plane.com/article/airport-data-apt-dat-file-format-specification/)) files.\n\nThis includes the following major components:\n\n1. [The `AptDat` module](#the-aptdat-module): Used to parse \u0026 query raw `apt.dat` files (e.g., the files stored on disk in your X-Plane installation)\n    - The [`AptDat`](#aptdataptdat) class itself: A parser for X-Plane's airport data files (which may contain more than 35,000 airports); a collection of [`Airport`](#aptdatairport) objects\n    - The [`Airport`](#aptdatairport) class: Represents an individual airport from an `apt.dat` file.\n2. [The `gateway` module](#the-gateway-module): Used to interact with [the X-Plane Scenery Gateway](https://gateway.x-plane.com) to get information about what airports are available, and to download individual scenery packs contributed by the community.\n    - [`airports()`](#xplane_airportsgatewayairports---dict): Queries for metadata on all 35,000+ airports on the Gateway. \n    - [`airport()`](#xplane_airportsgatewayairportairport_id---dict): Queries the Gateway for information about the specified airport itself, as well as metadata on all scenery packs submitted for it. Unlike [`scenery_pack()`](#xplane_airportsgatewayscenery_packpack_to_download---gatewayapt), though, this does *not* include actual `apt.dat` or DSF data. \n    - [`scenery_pack()`](#xplane_airportsgatewayscenery_packpack_to_download---gatewayapt): Downloads either the recommended pack for the specified airport, or the scenery pack with the specified `int` ID. Includes both the `apt.dat` data and DSF, where applicable.\n    - [`recommended_scenery_packs()`](#xplane_airportsgatewayrecommended_scenery_packsselective_apt_idsnone---collectionsiterablegatewayapt): A generator equivalent to calling [`scenery_pack()`](#xplane_airportsgatewayscenery_packpack_to_download---gatewayapt) to download the recommended scenery pack for every airport (or only a preselected list of airports, at your discretion).\n\n## Table of Contents\n\n* [Installation instructions](#installation-instructions)\n* [Sample code](#sample-code)\n  + [Parsing the default apt.dat file in your local X-Plane installation](#parsing-the-default-aptdat-file-in-your-local-x-plane-installation)\n  + [Getting metadata on airports from the Gateway](#getting-metadata-on-airports-from-the-gateway)\n  + [Downloaded the recommended scenery pack for an airport from the Gateway](#downloaded-the-recommended-scenery-pack-for-an-airport-from-the-gateway)\n* [The `AptDat` module](#the-aptdat-module)\n  + [AptDat.AptDat](#aptdataptdat)\n  + [AptDat.Airport](#aptdatairport)\n  + [AptDat.AptDatLine](#aptdataptdatline)\n  + [AptDat.RunwayType](#aptdatrunwaytype)\n* [The `gateway` module](#the-gateway-module)\n  + [gateway.GatewayApt](#gatewaygatewayapt)\n  + [gateway.GatewayFeature](#gatewaygatewayfeature)\n  + [API wrapping functions](#api-wrapping-functions)\n    - [`xplane_airports.gateway.airport`(_airport\\_id_) -\u003e dict](#xplane_airportsgatewayrecommended_scenery_packsselective_apt_idsnone---collectionsiterablegatewayapt)\n    - [`xplane_airports.gateway.airports`() -\u003e dict](#xplane_airportsgatewayairports---dict)\n    - [`xplane_airports.gateway.recommended_scenery_packs`(_selective\\_apt\\_ids=None_) -\u003e collections.Iterable\\[[GatewayApt](#gatewaygatewayapt)\\]](#xplane_airportsgatewayrecommended_scenery_packsselective_apt_idsnone---collectionsiterablegatewayapt)\n    - [`xplane_airports.gateway.scenery_pack`(_pack\\_to\\_download_) -\u003e [GatewayApt](#gatewaygatewayapt)](#xplane_airportsgatewayscenery_packpack_to_download---gatewayapt)\n* [Migration notes](#migration-notes)\n* [Running the tests (for maintainers)](#running-the-tests-for-maintainers)\n* [Publishing package updates to PyPI (for maintainers)](#publishing-package-updates-to-pypi-for-maintainers)\n\n## Installation instructions\n\n`xplane_airports` requires Python 3.6 or newer.\n\nInstall via pip with:\n\n`$ pip install xplane_airports`\n\nIf you're migrating from a pre-4.0 version of the library, see the [Migration notes](#migration-notes) section below.\n\n## Sample code\n\n### Parsing the default apt.dat file in your local X-Plane installation\n\n```python\nfrom xplane_airports.AptDat import AptDat, Airport\nfrom pathlib import Path\n\nxplane_installation = Path(input(\"Path to your X-Plane installation: \"))\nassert xplane_installation.is_dir(), f\"{xplane_installation} does not exist or is not a directory\"\nprint(\"Reading 35,000+ airports from disk (this will take awhile)\")\ndefault_xplane_apt_dat = AptDat(xplane_installation / 'Resources/default scenery/default apt dat/Earth nav data/apt.dat')\nprint(f\"{len(default_xplane_apt_dat)} airports found in your default apt.dat\\n\")\n\nksea = default_xplane_apt_dat['KSEA']\n\"\"\":type ksea: Airport\"\"\"\nprint(\"KSEA's airport data on disk begins:\")\nprint(ksea.head())\n```\n\n### Getting metadata on airports from the Gateway\n\n```python\nfrom xplane_airports.gateway import airports\nall_apts = airports()\nprint(\"There are %d airports on the X-Plane Scenery Gateway\" % len(all_apts))\nprint(\"KSEA has the following metadata on the Gateway:\")\nfor key, value in all_apts['KSEA'].items():\n    print('\\t' + key + ':', value)\n```\n\n### Downloaded the recommended scenery pack for an airport from the Gateway\n\n```python\nfrom xplane_airports.gateway import scenery_pack, GatewayApt\nksea_recommended_pack = scenery_pack('KSEA')\n\"\"\":type ksea_recommended_pack: GatewayApt\"\"\"\nprint(\"KSEA downloaded from the Gateway begins:\")\nprint(ksea_recommended_pack.apt.head())\n```\n\nMore sample code is available in the doctests in [the `gateway` module](#the-gateway-module) docs below.\n\n## The `AptDat` module\n\nTools for reading, inspecting, and manipulating X-Plane’s airport (apt.dat) files.\n\n### AptDat.AptDat\n\n_class_ `AptDat.AptDat`(_path\\_to\\_file=None_)\n\nA container class for [`Airport`](#aptdatairport) objects. Parses X-Plane’s gigantic `apt.dat` files, which may have data on tens of thousands of airports.\n\n**Fields**\n\n- `airports` (List\\[Airport\\])\n- `xplane_version` (int): The version of the apt.dat spec used by the airports in this collection\n\n**Static method** `from_file_text`(_apt\\_dat\\_file\\_text_, _from\\_file_) -\u003e [`AptDat`](#aptdataptdat)\\\nParameters:\n\n- **apt\\_dat\\_file\\_text** (_str_): The contents of an apt.dat (or ICAO.dat) file\n- **from\\_file** (_os.PathLike_): Path to the file from which this was read\n\n**Property** `ids`\\\nA generator containing the X-Plane IDs of all airports in the collection. Note that these IDs may or may not correspond to the airports’ ICAO identifiers.\\\nType: collection.Iterable\\[str\\]\n\n**Property** `names`\\\nA generator containing the names of all airports in the collection\\\nType: collection.Iterable\\[str\\]\n\n**Method** `search_by_id`(_apt\\_id_)\\\nParameter: **apt\\_id** (_str_) – The X-Plane ID of the airport you want to query\\\nReturns: The airport with the specified ID, or `None` if no matching airport exists in this collection.\\\nReturn type: Optional\\[[Airport](#aptdatairport)\\]\n\n**Method** `search_by_name`(_apt\\_name_)\\\nParameter: **apt\\_name** (_str_) – The name of the airport you want to query\\\nReturns: All airports that match the specified name, case-insensitive (an empty list if no airports match)\nReturn type: list\\[[Airport](#aptdatairport)\\]\n\n**Method** `search_by_predicate`(_predicate\\_fn_)\\\nParameter: **predicate\\_fn** (_(_[_Airport_](#aptdatairport)_)_ _\\-\u003e bool_) – We will collect all airports for which this function returns `True`\\\nReturn type: list\\[[Airport](#aptdatairport)\\]\n\n**Method** `sort`(_key='name'_)\\\nBy default, we store the airport data in whatever order we read it from the apt.dat file. When you call sort, though, we’ll ensure that it’s in order (default to name order, just like it’s always been in the shipping versions of X-Plane).\\\nParameter: **key** (_str_) – The [Airport](#aptdatairport) key to sort on\n\n**Method** `write_to_disk`(_path_to_write_to_)\\\nWrites a complete apt.dat file containing this entire collection of airports.\\\nParameter: **path_to_write_to** (_Optional_\\[_os.PathLike_\\]) – A complete file path (ending in .dat); if `None`, we'll use the path we read this apt.dat in from.\n\n### AptDat.Airport\n\nA single airport from an apt.dat file.\n\n_class_ `xplane_airports.AptDat.Airport`(_name: str_, _id: str_, _from\\_file: str = ''_, _has\\_atc: bool = False_, _elevation\\_ft\\_amsl: float = 0_, _text: List\\[[AptDat.AptDatLine](#aptdataptdatline)\\]=\\[\\]_)\\\n\nDataclass members:\n\n- _from_file_ (_pathlib.Path_; default empty): Path to the `apt.dat` file from which this airport was read\n- _raw_lines_ (List\\[str\\]; default empty): The complete text of the portion of the apt.dat file pertaining to this airport\n- _xplane_version_ (int; default 1100): The version of the X-Plane apt.dat spec this airport uses (e.g., 1050, 1100, 1130)\n- _tokenized_lines_ (List\\[Tuple\\]; default empty): An intermediate tokenization of the raw lines, used for speed of parsing\n\n**Static method** `from_lines`(_apt\\_dat\\_lines_, _from\\_file\\_name_) -\u003e [Airport](#aptdatairport)\\\nParameters:\\\n\n- **from\\_file\\_name** (_str_) – The name of the apt.dat file you read this airport in from\n- **apt\\_dat\\_lines** (_collections.Iterable\\[[AptDatLine](#aptdataptdatline)|str\\]_) – The lines of the apt.dat file (either strings or parsed AptDatLine objects)\n\n**Static method** `from_str`(_file\\_text_, _from\\_file\\_name_) -\u003e [Airport](#aptdatairport)\\\nParameters:\n\n- **file\\_text** (_str_) – The portion of the apt.dat file text that specifies this airport\n- **from\\_file\\_name** (_str_) – The name of the apt.dat file you read this airport in from\n\n**Method** `head(num_lines=10)` -\u003e str\\\nReturns the first `num_lines` of the `apt.dat` text for this airport\n\n**Property** `text` (List\\[[AptDatLine](#aptdataptdatline)\\])\\\nThe raw `str` lines transformed into more usable `AptDatLine` objects. Note that this will be measurably slow if you need to work with millions of lines.\n\n**Property** `name` (str)\\\nThe name of the airport, like \"Seattle-Tacoma Intl\"\n\n**Property** `id` (str)\\\nThe X-Plane identifier for the airport, which may or may not correspond to its ICAO ID\n\n**Property** `has_atc` (bool)\\\nTrue if the airport header indicates the airport has air traffic control\n\n**Property** `elevation_ft_amsl` (float)\\\nThe elevation, in feet above mean sea level, indicated in the airport header line\n\n**Property** `metadata` (Dict[MetadataKey, str])\\\nVarious key-value metadata pairs defined by X-Plane.\n\n**Property** `has_comm_freq` (bool)\\\nTrue if this airport defines communication radio frequencies for interacting with ATC\\\n\n**Property** `has_ground_routes` (bool)\\  \nTrue if this airport defines any destinations for ground vehicles (like baggage cars, fuel trucks, etc.), ground truck parking locations, or taxi routes\\\n\n**Property** `has_taxi_route` (bool)\\\nTrue if this airport defines routing rules for ATC’s use of its taxiways.\\\n\n**Property** `has_taxiway` (bool)\\\nTrue if this airport defines any taxiway geometry\\\n\n**Property** `has_taxiway_sign` (bool)\\\nTrue if this airport defines any taxi signs\\\n\n**Property** `has_traffic_flow` (bool)\\\nTrue if this airport defines rules for when and under what conditions certain runways should be used by ATC\\\n\n**Property** `latitude` (float)\\\nThe latitude of the airport, which X-Plane calculates as the latitude of the center of the first runway.\\\n\n**Property** `longitude` (float)\\\nThe longitude of the airport, which X-Plane calculates as the longitude of the center of the first runway.\\\n\n**Method** `has_row_code`(_row\\_code\\_or\\_codes_) -\u003e bool\\\nTrue if the airport has any lines in its text that begin with the specified row code(s)\\\nParameter: **row\\_code\\_or\\_codes** (_Union__\\[__int__,_ _str__,_ _collections.Iterable__\\[__int__\\]__\\]_) – One or more “row codes” (the first token at the beginning of a line; almost always int)\n\n**Method** `write_to_disk`(_path_to_write_to_)\\\nWrites a complete apt.dat file containing just this airport.\\\nParameter: **path_to_write_to** (_os.PathLike_) – A complete file path (ending in .dat)\n\n### AptDat.AptDatLine\n\nA single line from an `apt.dat` file.\n\n_class_ `xplane_airports.AptDat.AptDatLine`(_line\\_text_)\n\n**Method** `is_airport_header`() -\u003e bool\\\nTrue if this line marks the beginning of an airport, seaport, or heliport\n\n**Method** `is_file_header`() -\u003e bool\nTrue if this is part of an apt.dat file header\n\n**Method** `is_ignorable`() -\u003e bool\\\nTrue if this line carries no semantic value for any airport in the apt.dat file.\n\n**Method** `is_runway`() -\u003e bool\\\nTrue if this line represents a land runway, waterway, or helipad\n\n**Method** `runway_type` -\u003e [RunwayType](#aptdatrunwaytype)\\\nThe type of runway represented by this line\n\n**Property** `tokens` -\u003e list\\[str\\]\\\nThe tokens in this line\n\n### AptDat.RunwayType\n\n_class_ `xplane_airports.AptDat.RunwayType`\n\nEnum for row codes used to identify different types of runways:\n\n- LAND_RUNWAY\n- WATER_RUNWAY\n- HELIPAD\n\n## The `gateway` module\n\nTools for interfacing with the X-Plane Scenery Gateway’s API.\n\nDocs at: [https://gateway.x-plane.com/api](https://gateway.x-plane.com/api)\n\n### gateway.GatewayApt\n\n_class_ `xplane_airports.gateway.GatewayApt`(_apt: [AptDat.Airport](#aptdatairport), txt: Optional\\[str\\], readme: str, copying: str, pack\\_metadata: dict, apt\\_metadata: Optional\\[dict\\]_)\n\nAll the data we get back about an airport when we download a scenery pack via `scenery_pack()`\n\nDataclass members:\n\n- _apt_ ([Airport](#aptdatairport)): Python object with the contents of the `apt.dat` file\n- _txt_ (str or `None`): Contents of the DSF .txt file; airports with no 3D will not include this\n- _readme_ (str): Contents of the README for this scenery pack\n- _copying_ (str): Contents of the COPYING instructions for this scenery pack\n- _pack_metadata_ (dict): The JSON object received from the Gateway with metadata about this particular scenery pack\n- _apt_metadata_ (dict or `None`): The JSON object received from the Gateway with metadata about the airport this scenery pack represents; None if this hasn't been downloaded (yet)\n\n\n### gateway.GatewayFeature\n\n_class_ `xplane_airports.gateway.GatewayFeature`\n\nEnum class representing the features that may be used to tag scenery packs on the Gateway. Note that these are subject to frequent addition/removal/change; only a few are guaranteed to be stable.\n\n- HasATCFlow (guaranteed stable)\n- HasTaxiRoute (guaranteed stable)\n- HasNavaidConflict\n- AlwaysFlatten\n- HasLogTxtIssue\n- LRInternalUse (guaranteed stable)\n- ExcludeSubmissions (guaranteed stable)\n- HasGroundRoutes (guaranteed stable)\n- TerrainIncompatible\n- RunwayNumberingOrLengthFix\n- AlwaysFlattenIneffective\n- MajorAirport\n- TerrainIncompatibleAtPerimeter\n- RunwayNumberingFix\n- IconicAirport\n- FloatingRunway\n- GroundRoutesCertified\n- FacadeInjection\n- ScenicAirport\n- MisusedGroundPolygons\n- Top30\n- Top50\n- RunwayInWater\n- RunwayUnusable\n- TerrainMeshMissing\n- LowResolutionTerrainPolygons\n\n### API wrapping functions\n\n#### `xplane_airports.gateway.airport`(_airport\\_id_) -\u003e dict\n\nQueries the Scenery Gateway for metadata on a single airport, plus metadata on all the scenery packs uploaded for that airport.\\\nAPI endpoint documented at: [https://gateway.x-plane.com/api#get-a-single-airport](https://gateway.x-plane.com/api#get-a-single-airport)\\\n\nReturns: A dict with metadata about the airport\\\nParameter: **airport\\_id** (_str_) – The identifier of the airport on the Gateway (may or may not be an ICAO ID)\n\n```python\n\u003e\u003e\u003e expected_keys = {'icao', 'airportName', 'airportClass', 'latitude', 'longitude', 'elevation', 'acceptedSceneryCount', 'approvedSceneryCount', 'recommendedSceneryId', 'scenery'}\n\u003e\u003e\u003e ksea = airport('KSEA')\n\u003e\u003e\u003e all(key in ksea for key in expected_keys)\nTrue\n```\n\nIncludes metadata of all scenery packs uploaded for this airport:\n\n```python\n\u003e\u003e\u003e len(airport('KSEA')['scenery']) \u003e= 9\nTrue\n```\n\n```python\n\u003e\u003e\u003e all_scenery_metadata = airport('KSEA')['scenery']\n\u003e\u003e\u003e first_scenery_pack_metadata = all_scenery_metadata[0]\n\u003e\u003e\u003e expected_keys = {'sceneryId', 'parentId', 'userId', 'userName', 'dateUploaded', 'dateAccepted', 'dateApproved', 'dateDeclined', 'type', 'features', 'artistComments', 'moderatorComments', 'Status'}\n\u003e\u003e\u003e all(key in first_scenery_pack_metadata for key in expected_keys)\nTrue\n```\n\n#### `xplane_airports.gateway.airports`() -\u003e dict\n\nQueries the Scenery Gateway for all the airports it knows about. Note that the download size is greater than 1 MB.\\\nAPI endpoint documented at: [https://gateway.x-plane.com/api#get-all-airports](https://gateway.x-plane.com/api#get-all-airports)\\\n\nReturns a dict with metadata on all 35,000+ airports; keys are X-Plane identifiers (which may or may not correspond to ICAO identifiers), and values are various airport metadata.\n\n```python\n\u003e\u003e\u003e airports()['KSEA']\n{'AirportCode': 'KSEA', 'AirportName': 'Seattle Tacoma Intl', 'AirportClass': None, 'Latitude': 47, 'Longitude': -122, 'Elevation': None, 'Deprecated': None, 'DeprecatedInFavorOf': None, 'AcceptedSceneryCount': 2, 'ApprovedSceneryCount': 2, 'ExcludeSubmissions': 0, 'RecommendedSceneryId': 45283, 'Status': 'Scenery Submitted', 'SceneryType': 0, 'SubmissionCount': 2}\n```\n\n```python\n\u003e\u003e\u003e len(airports()) \u003e 35000\nTrue\n```\n\n#### `xplane_airports.gateway.recommended_scenery_packs`(_selective\\_apt\\_ids=None_) -\u003e collections.Iterable\\[[GatewayApt](#gatewaygatewayapt)\\] \n\nA generator to iterate over the recommended scenery packs for all (or just the selected) airports on the Gateway. Downloads and unzips all files into memory.\n\nParameter: **selective\\_apt\\_ids** (_Optional_\\[_collections.Iterable_\\[_str_\\]\\]) – If `None`, we will download scenery for all 35,000+ airports; if a list of airport IDs (as returned by `airports()`), the airports whose recommended packs we should download.\\\nReturns a generator of the recommended scenery packs; each pack contains the same data as a call to `scenery_pack()` directly\n\nEasily request a subset of airports:\n\n```python\n\u003e\u003e\u003e packs = recommended_scenery_packs(['KSEA', 'KLAX', 'KBOS'])\n\u003e\u003e\u003e len(list(packs)) == 3 and all(isinstance(pack, GatewayApt) for pack in packs)\nTrue\n```\n\nAudit airports for specific features:\n\n```python\n\u003e\u003e\u003e all_3d = True\n\u003e\u003e\u003e all_have_atc_flow = True\n\u003e\u003e\u003e all_have_taxi_route = True\n\u003e\u003e\u003e for pack in recommended_scenery_packs(['KATL', 'KORD', 'KDFW', 'KLAX']):\n...     all_3d \u0026= pack.pack_metadata['type'] == '3D' and pack.txt is not None\n...     all_have_atc_flow \u0026= GatewayFeature.HasATCFlow in pack.pack_metadata['features'] and pack.apt.has_traffic_flow()\n...     all_have_taxi_route \u0026= GatewayFeature.HasTaxiRoute in pack.pack_metadata['features'] and pack.apt.has_taxi_route()\n\u003e\u003e\u003e all_3d and all_have_atc_flow and all_have_taxi_route\nTrue\n```\n\n#### `xplane_airports.gateway.scenery_pack`(_pack\\_to\\_download_) -\u003e [GatewayApt](#gatewaygatewayapt)\n\nDownloads a single scenery pack, including its apt.dat and any associated DSF from the Gateway, and unzips it into memory.\n\nParameter: **pack\\_to\\_download** (_str_ or _int_) – If `int`, the scenery ID of the pack to be downloaded; if `str`, the airport whose recommended pack we should download.\\\nReturns the downloaded files and the metadata about the scenery pack\n\n```python\n\u003e\u003e\u003e expected_keys = {'sceneryId', 'parentId', 'icao', 'aptName', 'userId', 'userName', 'dateUploaded', 'dateAccepted', 'dateApproved', 'dateDeclined', 'type', 'features', 'artistComments', 'moderatorComments', 'additionalMetadata', 'masterZipBlob'}\n\u003e\u003e\u003e ksea_pack_metadata = scenery_pack('KSEA').pack_metadata\n\u003e\u003e\u003e all(key in ksea_pack_metadata for key in expected_keys)\nTrue\n\u003e\u003e\u003e scenery_pack('KORD').pack_metadata['type'] in ('3D', '2D')\nTrue\n\u003e\u003e\u003e all(isinstance(feature, GatewayFeature) for feature in scenery_pack('KMCI').pack_metadata['features'])\nTrue\n```\n\n## Migration notes\n\nVersion 4.0 of the library introduces a handful of important breaking changes:\n\nI've rewritten the `Airports` class with a few major changes for performance:\n  \n1. We no longer use `AptDatLine` objects by default. They're still available as a `@property` with the same name as their previous dataclass member (`text`), but we now use a tuple of tokenized lines as our primary data structure internally. This eliminated the single biggest bottleneck in parsing X-Plane's 35k+ airport default apt.dat, and cut the total parsing time down from \u003e 140 seconds on my machine to under 32 seconds.\n2. A number of other former dataclass members have been moved to `@property` methods. \n   \nNeither change should affect basically any sane usage of the `Airport` class *except* for construction (but even that you should probably be getting from the `AptDat` class or one of the `Airport` class's static methods!).\n\nVersion 4 also utilizes `@functools.cached_property` to cache some potentially-expensive `@property` methods in the `Airport` class. Since `functools` introduced this in Python 3.8, if you're on an earlier Python version, you won't get this caching behavior (you'll get normal properties instead). This is less than ideal, but it works.\n\n## Running the tests (for maintainers)\n\n[We use CircleCI](https://app.circleci.com/pipelines/github/X-Plane/xplane_airports) to run the test suite on every commit.\n\nYou can run the same tests that CircleCI does as follows:\n\n1. Doctest the Gateway module: `$ python -m doctest -v xplane_airports/gateway.py`\n2. Unit test the AptDat moduel: `$ python -m unittest discover -s xplane_airports/ -t xplane_airports/ -p test_*.py`\n\n## Publishing package updates to PyPI (for maintainers)\n\n1. Bump the version in setup.py\n2. Activate your virtual environment: `$ source env/bin/activate`\n3. Package it: `$ python3 setup.py sdist bdist_wheel`\n4. Upload\n    - To production: `$ python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*`\n    - To the test server: `$ python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*`\n5. Confirm all is well: https://pypi.org/project/xplane-airports/\n\nYou may also want to upgrade whatever project you have that depends on it: `$ pip3 install --upgrade xplane_airports`\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FX-Plane%2Fxplane_airports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FX-Plane%2Fxplane_airports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FX-Plane%2Fxplane_airports/lists"}