You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
887 B
PowerShell
31 lines
887 B
PowerShell
11 months ago
|
$searchResults = Get-Content ./input | Sort-Object {Get-Random} | ForEach-Object -ThrottleLimit 3 -Parallel {
|
||
11 months ago
|
(Invoke-RestMethod ('https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&q='+$_))[0]
|
||
|
}
|
||
11 months ago
|
|
||
11 months ago
|
$coordinateList = $searchResults
|
||
|
| ForEach-Object {
|
||
11 months ago
|
,@([Decimal]$_.lon,[Decimal]$_.lat)
|
||
|
}
|
||
11 months ago
|
| Sort-Object {$_[0][0]}
|
||
11 months ago
|
|
||
11 months ago
|
$output = [PSCustomObject]@{
|
||
11 months ago
|
type = 'FeatureCollection'
|
||
|
features = @(
|
||
11 months ago
|
[PSCustomObject]@{
|
||
11 months ago
|
type = 'Feature'
|
||
11 months ago
|
properties = [PSCustomObject]@{
|
||
|
_umap_options = [PSCustomObject]@{
|
||
|
color = 'LimeGreen'
|
||
|
}
|
||
|
name = 'turnhalle'
|
||
|
}
|
||
|
geometry = [PSCustomObject]@{
|
||
11 months ago
|
type = 'Polygon'
|
||
|
coordinates = ,$coordinateList
|
||
|
}
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
|
||
|
$output | ConvertTo-Json -Depth 99 | Out-File output.geojson
|