Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

KML: Fix bug that prevented loading a KMZ from HTTP correctly

  • Loading branch information...
commit 405ed6f8521c459179d9a0bb93d02d1b864e10a8 1 parent d9281b8
@gwaldron authored
Showing with 9 additions and 8 deletions.
  1. +1 −7 src/osgEarth/Registry.cpp
  2. +8 −1 src/osgEarthDrivers/kml/KML
View
8 src/osgEarth/Registry.cpp
@@ -62,22 +62,16 @@ _defaultFont ( 0L )
_taskServiceManager = new TaskServiceManager();
// activate KMZ support
- osgDB::Registry::instance()->addFileExtensionAlias( "kmz", "kml" );
osgDB::Registry::instance()->addArchiveExtension ( "kmz" );
+ osgDB::Registry::instance()->addFileExtensionAlias( "kmz", "kml" );
-#if OSG_MIN_VERSION_REQUIRED(3,0,0)
osgDB::Registry::instance()->addMimeTypeExtensionMapping( "application/vnd.google-earth.kml+xml", "kml" );
osgDB::Registry::instance()->addMimeTypeExtensionMapping( "application/vnd.google-earth.kmz", "kmz" );
- //osgDB::Registry::instance()->addMimeTypeExtensionMapping( "text/xml", "xml" );
- //osgDB::Registry::instance()->addMimeTypeExtensionMapping( "application/json", "json" );
- //osgDB::Registry::instance()->addMimeTypeExtensionMapping( "text/json", "json" );
- //osgDB::Registry::instance()->addMimeTypeExtensionMapping( "text/x-json", "json" );
osgDB::Registry::instance()->addMimeTypeExtensionMapping( "text/plain", "osgb" );
osgDB::Registry::instance()->addMimeTypeExtensionMapping( "text/xml", "osgb" );
osgDB::Registry::instance()->addMimeTypeExtensionMapping( "application/json", "osgb" );
osgDB::Registry::instance()->addMimeTypeExtensionMapping( "text/json", "osgb" );
osgDB::Registry::instance()->addMimeTypeExtensionMapping( "text/x-json", "osgb" );
-#endif
// pre-load OSG's ZIP plugin so that we can use it in URIs
std::string zipLib = osgDB::Registry::instance()->createLibraryNameForExtension( "zip" );
View
9 src/osgEarthDrivers/kml/KML
@@ -23,6 +23,7 @@
#include <osgEarth/URI>
#include <osgEarth/Registry>
#include <osgDB/ReaderWriter>
+#include <osgDB/FileNameUtils>
#include "KMLOptions"
namespace osgEarth { namespace Drivers {
@@ -49,7 +50,13 @@ namespace osgEarth { namespace Drivers {
options->setPluginData( "osgEarth::MapNode", mapNode );
options->setPluginData( "osgEarth::KMLOptions", (void*)&kmlOptions );
- return uri.readNode( options.get() ).releaseNode();
+ // for a KMZ archive over HTTP, we need to go through OSG's archive management system
+ if ( osgDB::containsServerAddress(uri.full()) && osgDB::getLowerCaseFileExtension(uri.full()) == "kmz" )
+ {
+ return osgDB::readNodeFile( uri.full() + "/.kml", options.get() );
+ }
+
+ return uri.getNode( options.get(), CachePolicy::NO_CACHE );
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.