This script retrieves published Azure location information and transforms it into GeoJSON format, with Point
features indicating Azure regions and LineString
features indicating links between paired regions.
$locations=az account list-locations --query "[?metadata.regionType=='Physical']"|convertfrom-json
@{type='FeatureCollection';features=$($locations|?{$_.metadata.pairedRegion.count -eq 1}|%{$r=$_;$p=$locations|?{$_.name -eq $r.metadata.pairedRegion[0].name}|select -first 1;if($null -ne $p -and -not (($r.metadata.longitude -eq 0 -and $r.metadata.latitude -eq 0) -or ($p.metadata.longitude -eq 0 -and $p.metadata.latitude -eq 0))){@{type='Feature';properties=@{region=$r.name;paired=$p.name};geometry=@{type='LineString';coordinates=@(@([double]$r.metadata.longitude,[double]$r.metadata.latitude),@([double]$p.metadata.longitude,[double]$p.metadata.latitude))}}}})+$($locations|?{-not ($_.metadata.longitude -eq 0 -and $_.metadata.latitude -eq 0)}|%{@{type='Feature';properties=@{name=$_.name;displayName=$_.displayName;physicalLocation=$_.metadata.physicalLocation;regionType=$_.metadata.regionType;regionCategory=$_.metadata.regionCategory;pairedRegions=($_.metadata.pairedRegion.name -join ',');'marker-symbol'='communications-tower'};geometry=@{coordinates=@([double]$_.metadata.longitude,[double]$_.metadata.latitude);type='Point'}}})}|convertto-json -depth 5 > azure-locations-map.geojson
An example output is included in azure-locations-map.geojson
.
GitHub supports displaying GeoJSON files, but the map rendering is somewhat unstable (sometimes shows only blue, sometimes fixed by force refreshing the page). A better rendering of the same azure-locations-map.geojson
can be viewed at geojson.io.