As a basis for this discussion I'm looking at two GPS tracks I recorded on a short Kayak trip on the Kayaderosseras Creek near Saratoga Springs. One was recorded using my trusty Garmin GPS and the other was recorded using the GPS receiver in my camera; a Canon Sx260. I'll discuss and compare the accuracy of the two tracks and touch on some other issues you might encounter while using GPS to collect geo-referenced data for use in your projects.
Image 1: Screen capture from Google Earth. The two lines (red and purple) are GPS tracks recorded simultaneously on Kayak trip on the Kayaderosseras Creek near Saratoga Springs (NY) |
I could do that by editing the track directly in Google Earth. That would be easy but it would be extremely tedious. There are several mouse clicks required to delete a point and there are a lot of points to get rid of to clean up this problem. You can see this in image two. For this screen capture I turned off the display of the track recorded by the camera (the red line) and selected the purple track for editing This makes visible the points recorded by the GPS. Each recorded point is represented by a red dot in the image and as you can see, there are a lot of points in just this short section of the route from the creek to my house. To remove this part of the track by editing it in GE you'd click on each points, select Delete, confirm the deletion and repeat. Lots of repeats.
- Export the track to a file. In Google Earth right click on the item in the Places pane, select Save Place As. Be sure to select KML from the format drop down so the file is saved in the KML format.
- Open the file in a text editor or an XML editor (I use Notepad++; a free and open source editor that is popular with programmers). You may need to configure your editor to recognize that the KML file is an XML file. That should allow the editor display the contents with nice formatting.
- In this case, removing the points I don't want comes down to removing all the points where the latitude is greater than the latitude of the put-in point. I'm in the northern hemisphere --so the latitude coordinates increase as you go north-- and all the points I want to keep are south of the put-in. Image three shows the map zoomed in on that location with the properties dialog for the point displayed. The properties dialog shows the latitude and longitude of the marker (and the location). This is how I got the latitude I will use as the basis for my edits; any point with a latitude greater than 43.034293 can be removed from the file. A potential complication is that that the coordinates in the KML file are stored using the decimal degree format. That's as you see it in the dialog seen in image three, but that representation is not the default for coordinates in Google Earth. The default is to represent coordinates in the Degree/Minute/Second format; like this: 43°02'03.4548" You can change the representation used by Google Earth using the Options dialog on the Tools menu.
Image 3: Screen capture from Google Earth. Viewing the properties of a marker added at the location of the start/end point of the trip. The properties dialog shows the coordinates of that point. |
Once you have a KML file containing your track, and you have a way to identify the point(s) to remove (in this case, latitude > 43.034293) you can remove the unwanted points from the file. To do this you do need to know a little bit about the XML data format and how to edit data stored in XML, but there are many introductions to XML available on-line and I've included references at the end of this post. Also, if you've done any work with HTML this will all look familiar. XML data elements are placed inside of tag pairs and you must delete the entire tag pair or you wil break the formatting of the file (and GE will complain when you try to reload it). You'll also need to recognize how the coordinates are represented. An example from my file looks like this:
<gx:coord>-73.79277999999999 43.034036 102.52</gx:coord>
The coordinate of the location is represented by three values with a space placed between each value (it might be hard to see the space; -73.79277999999999<space>43.034036<space>102.52). The values are:
-73.79277999999999 | longitude | a "west" longitude represented as a negative number |
43.034336 | latitude | a "north" latitude represented as a positive number |
102.52 | elevation | meters above sea level |
As discussed in the previous section, I want to delete any point where the latitude is greater than 43.034293, so this point can be removed from the file. The points are stored in the file in order, so once you find the place break between what you want and what you want to remove you can select all the bad rows and remove them. If editing data in this way is familiar to you then this should get you started. If this is entirely new then you may need more help. Look at the references or ask a friend who knows about this stuff.
With unwanted data removed from your file there is one final step; opening the file in Google Earth so you can see the results of your work. In Google Earth select "Open" from the File menu and find your edited file on disk. If you get warnings about errors check the file over for mis-matched tag pairs. That's it, you can save the file in your Places folder so that Google Earth reopens it automatically or you can reopen the file when you need it in the future.
This post is already rather long so I'm going to cover the other topics I raised at the start in a separate "part two" posting.