[talk-au] Simple linux shell script for batch processing

John Smith delta_foxtrot at yahoo.com
Sun Jun 21 15:39:22 BST 2009


--- On Sun, 21/6/09, Ross Scanlon <info at 4x4falcon.com> wrote:
> Now if I could just work out the exclude polygon filter for
> gpsbabel.

I got the following replies from Xoff... Didn't help me, but might help you...

----

If you want to change the excluded area there you just need to change the following lines:

POLYGONS[0]=${DIR}/polygon1.arc 
echo $'52.23 -0.3 
52.34 -1.2 
52.65 -0.3 
' > "${POLYGONS[0]}"

Replace the coordinates between $' and ' > with the corners of the area you want to exclude. So with the coordinates you mentioned it should look like this:

POLYGONS[0]=${DIR}/polygon1.arc 
echo $'-33.0 150.0 
-33.0 151.0 
-34.0 151.0 
-34.0 150.0 
' > "${POLYGONS[0]}"

----

I just noticed that there was a bug in the script. I accidentally had copied the code fore the second area two times into the script. I have updated this now. 

You may be able to find more information about the polygon files in the gpsbabel documentation. Because what I do in the script is basically creating a file for each polygon and then calling gpsbabel. Since I had a number of areas to exclude I added the filenames to a bash array and called gpsbabel for each filename in the list.

----

I had a look at the gpsbabel documentation (http://www.gpsbabel.org/htmldoc-1.3.6/filter_polygon.html). Apparently, the polygons must be closed. Repeating the first coordinate at the end of the list should work.

I better fix this in the script on the wiki-page and add a comment. When I uploaded the script I changed the polygons and forgot about this detail. I'm sorry about that!


      




More information about the Talk-au mailing list