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.
24 lines
705 B
PowerShell
24 lines
705 B
PowerShell
$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]
|
|
}
|
|
|
|
$coordinateList = $searchResults | ForEach-Object {
|
|
,@([Decimal]$_.lon,[Decimal]$_.lat)
|
|
}
|
|
|
|
$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
|