A civil-aviation data unit publishes a per-country count from this registry and wants it as a script that re-runs when the registry is refreshed. The interesting rows are the countries that come out at zero: some really have no listed airport, and some have one that the coarse coastline puts in the sea. The count has to keep every country so both kinds are visible.
Write a script that produces a per-country airport table.
The datasets are mounted where the script runs:
/data/countries.geojson — country and dependency polygons/data/airports.geojson — 893 airportsgeopandas, shapely, pyproj, pandas and numpy are available. Assign the finished table to a variable named `result`: a GeoDataFrame with one row per country, carrying the country geometry and
iso_a3, nameairports — airports whose point the country polygon containsAssign airports to countries by geometry. Do not write a file — the runner reads result.
/data/countries.geojson — EPSG:4326; the geometry is in geometry (Polygon / MultiPolygon).
| column | type | meaning |
|---|---|---|
country_id | string | CO- plus the ISO 3166-1 alpha-3 code |
name | string | Short name |
name_long | string | Long name |
iso_a3 | string | ISO 3166-1 alpha-3; -99 where Natural Earth assigns none |
iso_a2 | string | ISO 3166-1 alpha-2; -99 where Natural Earth assigns none |
continent | string | Continent |
subregion | string | UN subregion |
pop_est | number | Population estimate (persons) |
pop_year | integer | Year of the estimate |
gdp_md | number | GDP, millions of US dollars (USD m) |
gdp_year | integer | Year of the GDP figure |
economy | string | Natural Earth economy class |
income_group | string | World Bank income group |
/data/airports.geojson — EPSG:4326; the geometry is in geometry (Point).
| column | type | meaning |
|---|---|---|
airport_id | string | AP- plus the Natural Earth id |
name | string | Airport name |
iata_code | string | Three-letter IATA code; null for a few |
gps_code | string | Four-character ICAO code; null for a few |
type | string | major | mid | small | military | spaceport, and combinations such as 'major and military' |
location | string | What the point marks: terminal | ramp | runway | parking | freight | approximate |
scalerank | integer | Natural Earth prominence, 2 (largest) to 9 |
Run executes the script in your browser and shows you its output and a preview. Submit executes it again on the server and grades what result holds.
These are where the teaching is. Read them twice.
Points-per-polygon over a coarse boundary layer is where analysts first meet generalisation, and keeping the zeros is what lets them see it.
Files: /data/countries.geojson, /data/airports.geojson · assign result
4 scored, 0 informational
Assigns airports to countries with a spatial predicate
20%One row per country
30%Carries iso_a3, name and airports
20%Airports contained by any country
30%