Airports

%matplotlib inline

import requests
import geopandas
import matplotlib.pyplot as plt
source_url = ("https://www.naturalearthdata.com/"\
              "http//www.naturalearthdata.com/"\
              "download/10m/cultural/ne_10m_airports.zip"
             )
source_url
'https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_airports.zip'
air = geopandas.read_file(source_url)
air.head()
scalerank featurecla type name abbrev location gps_code iata_code wikipedia natlscale ... name_pl name_pt name_ru name_sv name_tr name_vi name_zh wdid_score ne_id geometry
0 9 Airport small Sahnewal LUH terminal VILD LUH http://en.wikipedia.org/wiki/Sahnewal_Airport 8.0 ... None None None Ludhiana Airport None None None 4 1159113785 POINT (75.95707 30.85036)
1 9 Airport mid Solapur SSE terminal VASL SSE http://en.wikipedia.org/wiki/Solapur_Airport 8.0 ... None None None None None None None 4 1159113803 POINT (75.93306 17.62542)
2 9 Airport mid Birsa Munda IXR terminal VERC IXR http://en.wikipedia.org/wiki/Birsa_Munda_Airport 8.0 ... Port lotniczy Ranchi None None M. O. Ranchi None Sân bay Birsa Munda 蘭契 4 1159113831 POINT (85.32360 23.31772)
3 9 Airport mid Ahwaz AWZ terminal OIAW AWZ http://en.wikipedia.org/wiki/Ahwaz_Airport 8.0 ... Port lotniczy Ahwaz None None Ahwaz International Airport Ahvaz Havalimanı Sân bay Ahvaz 阿瓦士 4 1159113845 POINT (48.74711 31.34316)
4 9 Airport mid and military Gwalior GWL terminal VIGR GWL http://en.wikipedia.org/wiki/Gwalior_Airport 8.0 ... Port lotniczy Gwalior None None Gwalior Airport None Sân bay Gwalior 瓜廖爾 4 1159113863 POINT (78.21722 26.28549)

5 rows × 36 columns

  • Project airports to Web Mercator

air = air.to_crs(epsg=3857)
  • Extract XY coordinates from a point GeoDataFrame

air["x"] = air.geometry.x
air["y"] = air.geometry.y
plt.scatter(air["x"], air["y"])
<matplotlib.collections.PathCollection at 0x7f093e8fae90>
../../_images/airports_cleaning_9_1.png
air.to_file('airports_clean.geojson', driver='GeoJSON')