Newbie
August 2015 - Aug 14, 2015 22:22:40 GMT
|
Post by jagilmer on Aug 14, 2015 22:11:11 GMT
How does one reverse the direction of a path that has been drawn in Google Earth -- for instance, from south - north to north - south? The direction in which a path is drawn has implication for the elevation profile.
|
|
Master Guide
March 2015 - Jan 20, 2022 4:27:51 GMT
|
Post by Hill on Aug 14, 2015 22:20:15 GMT
As far as I know, there is no way to reverse the order of the vertices which make up the path.
|
|
Wizard
March 2015 - May 6, 2024 18:48:10 GMT
|
Post by tek on Aug 15, 2015 11:31:35 GMT
Try this. It will create a folder with the files it creates.
[filelink type="xls" href="https://docs.google.com/spreadsheets/d/1lOuK4caehZddOMFxnuv9Vf9n_pXNSH9G/edit?usp=sharing&ouid=104895212319291608698&rtpof=true&sd=true"]Master of Points v1[/filelink]
|
|
Cartographer
April 2015 - May 7, 2024 23:18:09 GMT
|
Post by washi on Aug 15, 2015 12:34:01 GMT
I'm glad you responded, Tek. I thought it could probably be done by putting the data in a spread sheet and then sorting it in reverse order. I have absolutely no experience with spread sheets, but with your mastery of using spread sheets to create KML files, I thought if it could be done, you'd know how to do it. I was in the process of playing with a simply path when you posted.
I created a 4-segment path more or less at random. This is the file as viewed in a text editor:
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> <Document> <name>KmlFile</name> <Style id="s_ylw-pushpin"> <IconStyle> <scale>1.1</scale> <Icon> <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href> </Icon> <hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/> </IconStyle> </Style> <StyleMap id="m_ylw-pushpin"> <Pair> <key>normal</key> <styleUrl>#s_ylw-pushpin</styleUrl> </Pair> <Pair> <key>highlight</key> <styleUrl>#s_ylw-pushpin_hl</styleUrl> </Pair> </StyleMap> <Style id="s_ylw-pushpin_hl"> <IconStyle> <scale>1.3</scale> <Icon> <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href> </Icon> <hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/> </IconStyle> </Style> <Placemark> <name>Untitled Path</name> <styleUrl>#m_ylw-pushpin</styleUrl> <LineString> <tessellate>1</tessellate> <coordinates> 135.5228796523666,34.68495261282413,0 135.5789926935596,34.65768581762848,0 135.6026812712361,34.61739187311539,0 135.6097745134117,34.57188047682989,0 135.660250560469,34.55243302111015,0 </coordinates> </LineString> </Placemark> </Document> </kml>
I extracted the data points (between the <coordinates> tags). For those who are not accustomed to looking at KML code for a path, the structure is longitude coma latitude coma zero, which I presume marks the end of the data point.
I then reversed the order.
(Most of the paths I have created for serious purposes have thousands of data points. That's why I hoped that you, Tek, would know of a way to reverse sort them.)
I then pasted the reverse order points back into the code, copied it, and pasted it back into Google Earth.
The attached folder contains three paths 1) down to the southeast 2) up to the northwest 3) and down and back, with both sets of data points. I made recorded tours to demonstrate the directionality of the three paths. (Since they are overlapping, they appear only as one path. The recorded tours will work with the paths disabled, but since that paths are the point of the demonstration, I haven't done so.)
|
|
Wizard
March 2015 - May 6, 2024 18:48:10 GMT
|
Post by tek on Aug 15, 2015 15:54:49 GMT
I have spend some time to build up the said script under the feelings exactly the same as yours, Washi. Computers and applications exist not only to make us to digitize our lives. While digitizing our lives and knowledge, they also have to do a series of jobs we do for us in a simplest way. Therefore, I will refrain from explaining how to do that manually...for instance, you can paste it into a Word document and replace all the space-characters with new-line characters, then paste the list into Excel, then insert row numbers into the next column manually, then select the two columns, then sort it reverse according to the second column with the row numbers, then copy the row of coordinates, then paste it back into a new Word document, then replace back all new-line characters with spaces... It's too much. I can't imagine the time that would be wasted. The attached Excel file above is doing that perfectly. My aim, while coding it, was not simply reversing direction. That is, it does more than just reversing the direction and may look confusing (there are comments to explain). But ignore them, I simplified the attached file for only the purposes of reversing the direction. For paths, it reverses the path completely. Original: A B C Outcome: C B A For polygons, --since the last coordinate if exists is merely a 'close-the-polygon' command expression-- the slash makes the coordinate before the last one the starting point. Original: A B C A Outcome: C B A (C is not added since the Polygon tag silently closes the polygon for us) Maybe, I can modify the script to have it work in a web page later.
|
|
Full Member
Explorer
April 2015 - Sept 15, 2023 10:57:30 GMT
|
Post by TomKjeldsen on Aug 15, 2015 16:30:27 GMT
Hi Respect for your kml insights in this thread. just want point out a solution I have used a couple of times, worked fine, great. www.gpsies.com (found it a few years ago, not affiliated in any way) let's you 'create a track' - load your track/path kml/kmz and then save it in a various of ways, also by reversing the track/path direction, before save.
|
|
Wizard
March 2015 - May 6, 2024 18:48:10 GMT
|
Post by tek on Aug 15, 2015 16:46:16 GMT
A lot of sites do that. Another one is bikehike.co.uk/mapview.php But they may end with changes in the original kml file since their logic is based on using a GPS device or, at most, Maps. As long as you can re-open the kml file and find and copy the coordinates, no matter...
|
|
Full Member
Explorer
April 2015 - Sept 15, 2023 10:57:30 GMT
|
Post by TomKjeldsen on Aug 15, 2015 16:56:31 GMT
Thanks tek I kind of felt I was on deep water and this was not just about reversing a simple track/path. Thanks for enlightening a very interesting discussion. I stand back and will very curious keep looking into your very skilled insights /Tom
|
|
Cartographer
April 2015 - May 7, 2024 23:18:09 GMT
|
Post by washi on Aug 15, 2015 17:19:51 GMT
Hi Tek and Tom,
I'm not at all sure how to use either solution.
Tek, can you give me a simple step-by-step instruction. The path I'd like to reverse is in the KMZ called "Bonneville 1834" attached below. I can load the KML into a text editor and copy the data points coordinates. I don't know what to do next.
Tom, I'd be grateful if you could tell me how to proceed once I have logged onto gpsies.com.
(I've created a .txt file of the coordinates, and have also attached that.) [filelink type="txt" href="https://drive.google.com/file/d/1-xk_UWjah_RFkrQ538N_4Ih9o1ZvTd1t/view?usp=sharing"]Bonneville Coordinates.txt[/filelink] Attachments:Bonneville 1834.kmz (35.25 KB)
|
|
Full Member
Explorer
April 2015 - Sept 15, 2023 10:57:30 GMT
|
Post by TomKjeldsen on Aug 15, 2015 19:53:45 GMT
Hi washi Click 'back to classic view' at top (I can't find reverse on updated site for now) create - track creator - importer en fil - import a file (i'm on danish so pardon the maybe poor translation) - click import to your exported track/path kml/kmz choose export this track as Google Earth kml expand 'vis muligheder' show options - there should be a choice of 'show this track reverse' or something likewise choose that and export your file either directly to GE or save it. click download and open in GE or save attached is your example of Bonneville 1834.kmz Hope this helps
|
|
Cartographer
April 2015 - May 7, 2024 23:18:09 GMT
|
Post by washi on Aug 16, 2015 4:33:56 GMT
Thanks Tom!
I still find the utility a bit confusing to negotiate, but thanks to your kindness in taking the time to run my data through it, I can see that it works very well.
Bonneville's decision to find a route to the lower Columbia by traveling through the Grand Canyon of the Snake River has got to be one of the most epically unfortunate choices in the annals of exploration. His stubborn refusal to accept guidance back to the Snake River Valley and to return the way he came, has got to be one of the most epically stupid!
|
|
Wizard
March 2015 - May 6, 2024 18:48:10 GMT
|
Post by tek on Aug 16, 2015 13:00:28 GMT
Copy the placemark in GE (or just the coordinates in text editor), paste into cell C3 and click the button. Outcome: 1. The reversed order of the coordinates is in cell C6. 2. The kml with the reversed version of the coordinates is saved in the MoP_kml folder and is a polygon*. 3. If you provide the path of Google Earth client exe file, the kml is loaded in your Google Earth. *: I did not need a path placemark. If you want it as a path, I can modify the script.
|
|
Master Guide
March 2015 - Jan 20, 2022 4:27:51 GMT
|
Post by Hill on Aug 17, 2015 16:23:21 GMT
I had a suspicion I was probably incorrect since I'm not good at code editing. I'm glad to see so many others were able to help on this. Thanks all!
|
|
Newbie
June 2019 - Jun 28, 2019 7:01:30 GMT
|
Post by kurtist on Jun 28, 2019 7:14:41 GMT
Thank you for this tip. Here it is 4 years later, and thanks to you, GPSies.com did exactly what I needed to reverse the direction of a KML. Danke schoen.
|
|