Created
September 13, 2019 12:35
-
-
Save adamdriscoll/23000bfefacf7ea76c1207fe55f171ab to your computer and use it in GitHub Desktop.
Map Cluster Example for Universal Dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-UDButton -Text "Add marker to cluster" -OnClick { | |
Add-UDElement -ParentId 'cluster-layer' -Content { | |
$Random = Get-Random -Minimum 0 -Maximum 100 | |
$RandomLat = $Random + 400 | |
New-UDMapMarker -Latitude "51.$RandomLat" -Longitude "-0.$Random" | |
} | |
} | |
New-UDButton -Text "Clear cluster" -OnClick { | |
Clear-UDElement -Id 'cluster-layer' | |
} | |
New-UDMap -Id 'map' -Endpoint { | |
New-UDMapLayerControl -Id 'layercontrol' -Content { | |
New-UDMapBaseLayer -Name "Black and White" -Content { | |
New-UDMapRasterLayer -TileServer 'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png' | |
} | |
New-UDMapOverlay -Name "Cluster" -Content { | |
New-UDMapMarkerClusterLayer -Id 'cluster-layer' -Markers @( | |
1..100 | ForEach-Object { | |
$Random = Get-Random -Minimum 0 -Maximum 100 | |
$RandomLat = $Random + 400 | |
New-UDMapMarker -Latitude "51.$RandomLat" -Longitude "-0.$Random" | |
} | |
) | |
} -Checked | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment