Bug #716

kml2gmt and line breaks in kml file

Added by Dariusz almost 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:2015-06-05
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.1.x Platform:Windows

Description

At least versions 5.1.1 and 5.1.2.
Coordinates block must be preceeded and ended by line break. So for example

<Polygon><outerBoundaryIs><LinearRing><coordinates>-115.7,32.8 ... -115.7,32.8</coordinates></LinearRing></outerBoundaryIs></Polygon>
must be transformed to:
<Polygon><outerBoundaryIs><LinearRing><coordinates>
-115.7,32.8 ... -115.7,32.8
</coordinates></LinearRing></outerBoundaryIs></Polygon>
Otherwise the .xy file obtained from kml file:
gmt kml2gmt file_name.kml -V > file_name.xy
looks like this:
> Next feature

> Next feature

> Next feature

...

> Next feature

13.6 53.3
-113.7 53.4

...

> Next feature

> Next feature

> Next feature

...

(only pieces of coordinate sets from time to time among many empty > Next feature. Most of coordibates are lost. Moreover some of coordinate numbers are broken, like 13.6 here instead of -113.6.)

Paths without linebreaks.kml.xy (96 Bytes) Dariusz , 2015-06-05 09:03

Paths.kml (6.58 KB) Dariusz , 2015-06-05 09:03

Paths.kml.xy (3.61 KB) Dariusz , 2015-06-05 09:03

kml2gmt.bat (128 Bytes) Dariusz , 2015-06-05 09:03

Paths without linebreaks.kml (6.49 KB) Dariusz , 2015-06-05 09:03

Associated revisions

Revision 14327
Added by Paul almost 2 years ago

Address issue #716

History

#1 Updated by Paul almost 2 years ago

  • Status changed from New to Feedback

Could you please post a file that we can test with?

#2 Updated by Dariusz almost 2 years ago

Sure, here are .bat file, input and output files. Perhaps using the name of module as name of bat file is not good idea.

gmt kml2gmt "Paths without linebreaks.kml" -V > "Paths without linebreaks.kml.xy" 
gmt kml2gmt "Paths.kml" -V > "Paths.kml.xy"
And when coordinates block has no linebraks at the ends, the output is:
> -L"Path1" 
> -L"Path2" 
> -L"Path3" 
> -L"Path4" 
> -L"Path5" 
> -L"Path6" 
> -L"Path7" 
> -L"Path8"
(no coordinates at all in this particular case)

#3 Updated by Paul almost 2 years ago

  • Status changed from Feedback to Resolved
  • Target version set to Candidate for next bugfix release

I guess we based our algorithm on Google Earth KML output which is more structured and did not consider a single line with lots of coordinates. Now we do, should be fixed in r14327.

#4 Updated by Paul almost 2 years ago

  • Status changed from Resolved to Closed

Closing this guy.

Also available in: Atom PDF