$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) } | Sort-Object {$_[0][0]} $output = [PSCustomObject]@{ type = 'FeatureCollection' features = @( [PSCustomObject]@{ type = 'Feature' properties = [PSCustomObject]@{ _umap_options = [PSCustomObject]@{ color = 'LimeGreen' } name = 'turnhalle' } geometry = [PSCustomObject]@{ type = 'Polygon' coordinates = ,$coordinateList } } ) } $output | ConvertTo-Json -Depth 99 | Out-File output.geojson