format code
parent
acdc4d79e4
commit
103ef49ab6
@ -1,9 +1,23 @@
|
|||||||
$a = Get-Content ./input | Sort-Object {Get-Random} | ForEach-Object -ThrottleLimit 3 -Parallel {
|
$searchResults = Get-Content ./input | Sort-Object {Get-Random} | ForEach-Object -ThrottleLimit 3 -Parallel {
|
||||||
(Invoke-RestMethod ('https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&q='+$_))[0]
|
(Invoke-RestMethod ('https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&q='+$_))[0]
|
||||||
}
|
}
|
||||||
$b = $a | ForEach-Object {
|
|
||||||
|
$coordinateList = $searchResults | ForEach-Object {
|
||||||
,@([Decimal]$_.lon,[Decimal]$_.lat)
|
,@([Decimal]$_.lon,[Decimal]$_.lat)
|
||||||
}
|
}
|
||||||
$o = [pscustomobject]@{type = 'FeatureCollection'; features = @([pscustomobject]@{type = 'Feature'; properties = [pscustomobject]@{}; geometry = [pscustomobject]@{type = 'Polygon'; coordinates = ,$b}})}
|
|
||||||
|
|
||||||
$o | ConvertTo-Json -Depth 99 | Out-File output.geojson
|
$output = [pscustomobject]@{
|
||||||
|
type = 'FeatureCollection'
|
||||||
|
features = @(
|
||||||
|
[pscustomobject]@{
|
||||||
|
type = 'Feature'
|
||||||
|
properties = [pscustomobject]@{}
|
||||||
|
geometry = [pscustomobject]@{
|
||||||
|
type = 'Polygon'
|
||||||
|
coordinates = ,$coordinateList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
$output | ConvertTo-Json -Depth 99 | Out-File output.geojson
|
||||||
|
Loading…
Reference in New Issue