logo       

A couple of filtering problems with CSV: msg#00027

hardware.gps.gpsbabel.general

Subject: A couple of filtering problems with CSV

Hi all,

I have been experimenting with filters to manage my pocket queries
and have come up against a couple of issues.

1. CSV Bounds problem

I use a simple csv ignore file as advertised on the GPSBabel website
to filter caches out of pocket queries that I want to ignore for one
reason or another using the following

gpsbabel -i gpx -f caches.gpx -i csv -f ignore.csv -x
duplicate,shortname,all -o gpx -F caches-filtered.gpx

It filters mostly correctly (see 2 below) but I have a problem with
the resulting bounds in the output file - caches-filtered.gpx in this
case.

The ignore.csv contains a list of waypoints in the following format.

0, 0, GC1234 and later -43.5, 172.7, GC1234

The filter works well and removes the ignored caches.

The problem I have though is that one corner of the bounds for the
output file are set at 0,0 which results in a bounding box that
encompasses much of the world when extended to the caches down in
little ole New Zealand.

<bounds minlat="-43.869617000" minlon="0.000000000"
maxlat="0.000000000" maxlon="173.077167000"/>

When the GPX is opened in Google Earth, this means that the view
zooms to the middle of the Indian Ocean west of Australia. Naturally,
there are no waypoints to be found at 0,0. All of the waypoints are
clustered around ~ -43,172.5

I thought that this was caused by the use of 0,0 in the ignore file,
but I also tried changing 0,0 to co-ordinates near Christchurch, New
Zealand in the ignore file but this still resulted in the minlon and
maxlat of 0 being produced. Could this have anything to do with us
being located near the +/-180 boundary?

Is there some way of having the bounds recalculated so that they
always properly express the co-ordinates to be found in the resulting
file, rather than some temporary state during processing? This is
only a problem when filtering the GPX XML with CSV.

2. CSV truncation error

A second surprise I discovered one day when out attempting a cache
was that GPSBabel had truncated some of the cache descriptions during
processing of the ignore list. I later tracked this down to an
apparent dislike for apostrophe's in the GPX XMl elements. This
truncation doesn't occur during all other GPX processing and has only
occurred when csv files are included in the mix.

I assume this is occurring as the CSV parser is choking on some
special characters. Interestingly, it has only occurred when being
run with the CSV filter as shown above. In the case below it appears
to be a single quote mark.

What appeared to happen was that the following element in GPX XML...

---- start ----
<groundspeak:long_description html="False">Information needs
to be gathered along the road to the beach for you to be able to find
the cache at the destination. At each WP it is safe to pull over to
the side of the road to read the information. You may not even need
to get out of your vehicle at some WP’s.

WP1 The sign posts at the turnoff.
Green sign How many Km’s to Motunau Beach - answer 1A
Blue sign What is the number – answer BC48
Calculate D = A-C

WP2 Glendhu Rd sign. S42° 59.675 E173° 00.364
What is the number - answer 1&gt;EF8

WP3 Letterbox property of JR McKenzie S43° 00.490 E173° 00.351
What is the number – answer 6GH

WP4 Letterbox for the Coringa property S43° 01.713 E173° 01.339
What is the number – answer 1JKL

WP5 Signposts S43° 02.671 E173° 04.017
Happy Valley Rd What is the number – answer 1MN4
How many Km’s to the Hurunui River Mouth – answer P8

WP6 Beachfront speed sign S43° 02.969 E173° 04.630
How many knots are on the sign – answer Q

There is a convenient picnic table close to WP6 to calculate the
coordinates for the cache.

South CP JD. FMA East BEG KH.LQN

It is a short stroll to the cache site. While you are here you might
also like to take a stroll up to the headland where there are
fantastic views overlooking the river, island and Pegasus Bay
including Banks Peninsular on a fine day. Motunau Vista cache GC100NV
is located in that area.

The cache is a camo painted 1.25L snaplock container. When hidden the
contents included log book, stash note, pencil, pencil sharpener and
a selection of swaps.</groundspeak:long_description>
---- end ----

became the following after being filtered against the ignore csv file

---- start ----
<groundspeak:long_description html="False">Information needs
to be gathered along the road to the beach for you to be able to find
the cache at the destination. At each WP it is safe to pull over to
the side of the road to read the information. You may not even need
to get out of your vehicle at some WP$</groundspeak:long_description>
---- end ----

Both of these I've tested against command line 1.3.0, 1.3.2a and
1.3.3 on Mac OS X and they all exhibit this behaviour.

Let me know if I can provide more info on either of these issues to
help.

Cheers Gav
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Gpsbabel-misc mailing list http://www.gpsbabel.org
Gpsbabel-misc@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, change list options, or see archives, visit:
https://lists.sourceforge.net/lists/listinfo/gpsbabel-misc



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise