UDMap is a component to display interactive maps with all kinds of customizations. You’ll be able to add markers, draw routes and other polygons, toggle layers and even create heatmaps.
Map Features
To create a map, you’ll use the New-UDMap cmdlet and then define different features of that map. Maps support interactively adding and removing features so you can integrate into other Universal Dashboard components. Below are some of the components available in a map.
Tile Layers
UDMap supports defining one or more raster layers that can use standard tile servers. It supports both open tile servers, such as OpenStreetMaps, as well as the Bing Maps tile server (requires API key).
To define a base tile layer, use the New-UDMapRasterLayer cmdlet.
You can create map markers using the New-UDMapMarker cmdlet. This allows you to place markers on the map to highlight points of interest. Markers allow you to customize the icon with New-UDMapIcon, add a popup with New-UDMapPopup or cluster them together by putting them into a New-UDMapMarkerClusterLayer. An example marker could be created like so.
Using the New-UDMapVectorLayer cmdlet you can define various types of vectors that define areas of the map. Using this cmdlet you could create routes like Google Map directions or highlight areas of interest using polygons. This cmdlet supports arrays of latitude and longitude as well as GeoJSON. This means that you can hook it right up to your existing SQL Server and create vectors using standard GeoJSON columns.
In this example, we are defining a circle and rectangle around areas in Hailey.
New-UDMap -Endpoint {
New-UDMapRasterLayer -TileServer 'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png'
New-UDMapVectorLayer -Latitude 43.52107 -Longitude -114.31644 -Radius 400 -Color blue -FillColor blue -Circle
New-UDMapVectorLayer -Rectangle -Color red -FillColor red -LatitudeBottomRight 43.52107 -LongitudeBottomRight -114.31644 -LatitudeTopLeft 43.68263 -LongitudeTopLeft -114.36373
} -Height '100ch'
You can even more fancy, you could use a GeoJSON data set. In this example, we are using the Singapore National Parks Board’s GeoJSON for the Park Connector Loop.
Layer controls allow you to define layers within your map. You can add base layers, such as satellite or road views, and overlay layers, such as markers or polygons. Users can then use the layer control to toggled between base layers and enable and disable overlays.
A special type of layer that you can add to your map is a heatmap layer. The heatmap layer takes an array of latitude, longitude and intensity values to create a heatmap over the top of the base layer.
The UDMap components support many of the standard UD interactivity cmdlets. You can add features dynamically to the map using Add-UDElement. You can remove those features using Remove-UDElement. You can even pan and zoom the map using Set-UDElement.