Product: PowerShell Universal Version: 4.2.17
I am trying to use New-UDMapVectorLayer to draw a line on the map, but I can’t seem to see the proper way to mark the positions. Here is what I have so far (fake lat/long)
New-UDMapVectorLayer -Polyline -Positions @{
[PSCustomObject]@{Latitude = "37" ; Longitude = "-75" }
[PSCustomObject]@{Latitude = "38" ; Longitude = "-76" }
}
Nothing pops up on the map though I tried doing geojson as well with no luck
$geojson = @'
{
"type": "Feature",
"geometry": {
"type": "linestring",
"coordinates": [[37, -75], [38, -76]]
},
"properties": {
"name": "testline"
}
}
'@ | ConvertTo-Json
New-UDMapVectorLayer -GeoJSON $geojson
It did give me an error though
Error rendering component (map-vector-layer) Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=Component for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 5070/r/<@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:647200 r@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1605586 Suspense div a@https://universal.domain.com/MapTest/3017.18f3b2b6b19901604032.bundle.js:2:274110 5070/r/<@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:647200 r@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1605586 Suspense main N@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:526166 5070/r/<@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:647200 t@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1384899 t@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1386882 div Suspense 5070/r/<@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:647200 Suspense u@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:63935 m@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:64452 g@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:64651 s@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:77880 r@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1440560 94931/i/l/<@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1441425 Dashboard@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:574174 t@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1384899 t@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1386882 div qe@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1618624 Ye@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1619821 Xe@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1619319 nt@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1622594 t@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1381620 t@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1376204 d@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1352813 l@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1072648 r@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1440560 94931/i/l/<@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1441425 bt@https://universal.domain.com/MapTest/index.cbc262558ed56a118b3e.bundle.js:152:1624661
@Adam Driscoll Do you have any examples or documentation for drawing a polyline on a map? I couldn’t find anything for either Powershell Universal, or the old Universal Dashboard versions.
Tried a few more things here after looking at the current map documentation for an interactive map and seeing the heatmap was an array of arrays. Neither of these gives me the polylines though.
New-UDMapVectorLayer -Polyline -Positions {
@(
@("37", "-75"),
@("38", "-76")
)
}New-UDMapVectorLayer -Polyline -Positions {
@("37", "-75")
@("38", "-76")
}
Noticed that some examples have the components in a overlay, so I tried that, as well as setting fill color, opacity, and weight. Still no dice.
New-UDMapOverlay -name "polyline" -content {
New-UDMapVectorLayer -FillColor "black" -FillOpacity 100 -opacity 100 -weight 50 -Polyline -Positions {
@("37", "-75")
@("38", "-76")
}
}Ok. Got it working.
New-UDMapVectorLayer -FillColor "black" -FillOpacity 100 -opacity 100 -weight 50 -Polyline -Positions @(
@("37", "-75");
@("38", "-76")
)
@Adam Driscoll, can this be added to the documentation for future people?
EDIT:
Found a fork of old UD documentation that specifically shows it should be an array of arrays.
github.com
The current help/documentation just says it’s an object
github.com