Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with gzipped KML files (GDAL 2.4.2 and 3.0.1) #1743

Closed
simoneves opened this issue Jul 30, 2019 · 7 comments
Closed

Problem with gzipped KML files (GDAL 2.4.2 and 3.0.1) #1743

simoneves opened this issue Jul 30, 2019 · 7 comments
Milestone

Comments

@simoneves
Copy link

Raleigh_Stops.kml.gz
I have a couple of KML files which were received in gzipped form, with a .kml.gz extension. These files are not read correctly by OGR using the /vsigzip virtual path. No error is thrown, and the geo (POLYGON) data comes in correctly, but all the other metadata for each feature is lost, and the other virtual data (name, description etc.) is presented differently.

Using the attached file, the results of...
ogrinfo Raleigh_Stops.kml OGRGeoJSON
...and...
ogrinfo /vsigzip/Raleigh_Stops.kml.gz OGRGeoJSON
...are very different.

This is with GDAL 2.4.2 built on Ubuntu 19.04. I am in the process of testing with 3.0.1.

@simoneves simoneves changed the title Problem with gzipped KML files (GDAL 2.4.2) Problem with gzipped KML files (GDAL 2.4.2 and 3.0.1) Jul 30, 2019
@simoneves
Copy link
Author

Also confirmed with 3.0.1.

For both versions, we are building GDAL --with-libkml pointing at libkml from a local build of https://github.com/google/libkml (the most recent, which isn't very recent), which itself references a local build of libexpat 2.2.5.

@simoneves
Copy link
Author

OK, there's a difference I hadn't noticed before. ogrinfo on the unzipped file invokes the LIBKML driver. With the gzipped file, it invokes the KML driver. This would explain the different metadata presentation!

Is there a way to force it to use the LIBKML driver in the VSI case? ...as that's the one which correctly extracts the other columns?

@simoneves
Copy link
Author

Checking options of GDALOpenEx...

@simoneves
Copy link
Author

OK, so I tried passing...
const char* minimal_drivers[] = {"ESRI Shapefile", "GeoJSON", "LIBKML", nullptr};
...to GDALOpenEx (as those are the only geo files our system officially supports) but while it still happily loads Shapefiles, GeoJSONs, and uncompressed KMLs, it now won't load a gzipped KML at all. We are detecting the type and adding the /vsigzip/ prefix correctly. Do I have to add anything else to that list to allow VSI to work too?

@simoneves
Copy link
Author

@rouault will the change allow the LIBKML driver to load the file without having to restrict the driver set? In other words, does it normally try LIBKML before KML?

@rouault
Copy link
Member

rouault commented Jul 30, 2019

does it normally try LIBKML before KML?

yes

@simoneves
Copy link
Author

OK, thanks for fixing. Will wait for 3.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants