Skip to main content

Geographic Layout

To look at where the players came from, let's switch to a geographic layout.

Visualization

NetPanorama specification


{
"data": [
{
"name": "players",
"format": {"type": "csv"},
"url": "/data/tulip/chess.candidates.1948.1990.csv",
"transform": [
{"type": "addIndex", "as": "id"},

We use the geocode transform to look up the lat/lon for each birthplace


{"type": "geocode", "locationField": "Birth Place" }


]
},
{
"name": "games",
"format": {"type": "csv"},
"url": "/data/tulip/wcc.games.1948.1990.csv"
}
],

"networks": [
{
"name": "net",
"nodes": "players",
"links": "games",
"directed": false,
"source_node": [ "Name", "Player 1" ],
"target_node": [ "Name", "Player 2" ]
}
],

We define a map layer, specifying what geographic region to show, and which map tiles to use.


"maps": [
{
"name": "my_map",
"tiles": "Stamen_TerrainBackground",
"zoomLevel": 3,
"center": [51.5062, -0.1263]
}
],


We define a layout that positions nodes so that they are positioned correctly relative to the map layer


"layouts": [
{
"name": "net-layout",
"network": "net",

"map": "my_map",
"lat": {"field": "lat"},
"lng": {"field": "lon"}
}
],



"vis": [
{
"entries": "net.links",
"layout": "net-layout",
"mark": {
"type": "linkpath",
"start": "source",
"end": "target"
}
},
{
"entries": "net.nodes",
"layout": "net-layout",
"mark": {
"type": "circle",
"area": 70,
"fill": "steelblue",
"tooltip": { "field": "Name" }
}
},


We add a mark to render the map


{
"mark":{
"type": "map",
"map": "my_map"
},
},


]

}