Kml2gmt functioning?

The kml2gmt command doesn’t seem to be working, and it used to. It now returns zero output features on any .kml file I try to feed it.

Could someone please try it with a KML file (any file) and let me know whether it works for them. I’m using GMT version (on a MacBook Pro):

Version 6.4.0_dad5851_2022.04.25, which I updated, just today.

Example command: gmt kml2gmt file_name.kml -Fl, where “file_name” is any .kml file.

There is a test in the test/kml dir that passes. When I run part of it manually

gmt kml2gmt coast.kml

it runs fine

We recently did a whole-same upgrade of the option parsers in most modules, so it is possible a few things broke. however, I tried Joaquims case with file input and stdin input and seems to work . Specifically, this test

gmt kml2gmt -Fl coast.kml

runs fine. Are you getting any error or messages? With -V or -Vd?

Thanks, Joaquim and Paul. Yep. I get good results out of the coast.kml file, too.

That means it must be something in the file I’m trying to convert. When I use the -Vd, the final lines of the output look like this:

kml2gmt [INFORMATION]: Writing Data Table to Standard Output stream
kml2gmt [DEBUG]: GMT_Begin_IO: Output resource access is now enabled [record-by-record]
kml2gmt [DEBUG]: Found readable file IS2_RGT_0001_28-Dec-2018_28-Dec-2018.kml
kml2gmt [DEBUG]: Calling nc_open on IS2_RGT_0001_28-Dec-2018_28-Dec-2018.kml, ncid = 0, err = -51
kml2gmt [DEBUG]: Found readable file IS2_RGT_0001_28-Dec-2018_28-Dec-2018.kml
kml2gmt [INFORMATION]: Processing IS2_RGT_0001_28-Dec-2018_28-Dec-2018.kml
kml2gmt [INFORMATION]: Only output features with geometry: Line
kml2gmt [DEBUG]: GMT_End_IO: Output resource access is now disabled
kml2gmt [INFORMATION]: Found 0 features with selected geometry
kml2gmt [DEBUG]: gmtlib_unregister_io: Unregistering object no 0 [n_objects = 0]
kml2gmt [DEBUG]: Entering GMT_Destroy_Session

When the file is imported to Google Earth and it appears just fine.

A zip of this file is attached. I lack tools to investigate further. This is an ICESat-2 Reference Ground Track. (104.3 KB)

When I unzip that file it says it is a kml file but it just contains hex code:

504b 0304 1400 0808 0800 1850 534d 0000
0000 0000 0000 0000 0000 2800 0000 4953
325f 5247 545f 3030 3031 5f32 382d 4465
632d 3230 3138 5f32 382d 4465 632d 3230

So either you sent the wrong thing or something strange happened. Certainly, not KML as is.

Actually, it is a zip of a zip. Renaming what is extracted to and unzipping a 2nd time gives a KML and kml2gmt is happy with it.

Thanks, Paul. I guess GoogleEarth can unzip on the fly. Didn’t realize that they were “pre-zipped.”

Close issue!