Author Posts

August 22, 2018 at 1:42 pm

Hi everyone. I want use this code

Start-Process "http://www.overpass-api.de/api/xapi?map?bbox= 5.974899,50.662127,6.218150, 50.857233

 

but I'dlike toaks user to enter bbox i tried like that but it didnt work well and the result was not ok. Please how can i write it in good way:

$minLon = Read-Host "Pleas enter minLon"
$minLat = Read-Host "Pleas enter minLat"
$maxLon = Read-Host "Pleas enter maxLon"
$maxLat = Read-Host "Pleas enter maxLat"
$bbox = $minLon,$minLat,$maxLon,$maxLat

Start-Process "http://www.overpass-api.de/api/xapi?map?bbox= 5.974899,50.662127,6.218150, 50.857233

Thanks very much.

August 22, 2018 at 2:57 pm

You are building bbox as an array. You need to build a string with comma delimited values to build the url. There are many ways to do things, but you could something like this to fill in the blanks in the URL:

$minLon = Read-Host "Pleas enter minLon"
$minLat = Read-Host "Pleas enter minLat"
$maxLon = Read-Host "Pleas enter maxLon"
$maxLat = Read-Host "Pleas enter maxLat"
$url = 'http://www.overpass-api.de/api/xapi?map?bbox={0},{1},{2},{3}' -f $minLon,$minLat,$maxLon,$maxLat

Start-Process $url

August 22, 2018 at 6:54 pm

Thank you very much. It worked very good.