Rules (line segments) connecting SEA to every airport reachable via direct flight
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"width": 800,
"height": 500,
"layer": [
{
"data": {
"url": "data/us-10m.json",
"format": {
"type": "topojson",
"feature": "states"
}
},
"projection": {
"type": "albersUsa"
},
"mark": {
"type": "geoshape",
"fill": "lightgray",
"stroke": "white"
}
},
{
"data": {
"url": "data/airports.csv"
},
"projection": {
"type": "albersUsa"
},
"mark": "circle",
"encoding": {
"longitude": {
"field": "longitude",
"type": "quantitative"
},
"latitude": {
"field": "latitude",
"type": "quantitative"
},
"size": {"value": 5},
"color": {"value": "gray"}
}
},
{
"data": {
"url": "data/flights-airport.csv"
},
"transform": [
{"filter": {"field": "origin", "equal": "SEA"}},
{
"lookup": "origin",
"from": {
"data": {
"url": "data/airports.csv"
},
"key": "iata",
"fields": ["latitude", "longitude"]
},
"as": ["origin_latitude", "origin_longitude"]
},
{
"lookup": "destination",
"from": {
"data": {
"url": "data/airports.csv"
},
"key": "iata",
"fields": ["latitude", "longitude"]
},
"as": ["dest_latitude", "dest_longitude"]
}
],
"projection": {
"type": "albersUsa"
},
"mark": "rule",
"encoding": {
"longitude": {
"field": "origin_longitude",
"type": "quantitative"
},
"latitude": {
"field": "origin_latitude",
"type": "quantitative"
},
"longitude2": {
"field": "dest_longitude",
"type": "quantitative"
},
"latitude2": {
"field": "dest_latitude",
"type": "quantitative"
}
}
}
]
}