google earth plugin - Displaying KMZ files behind protected networks -


i'm trying display kmz file resides in folder password protected , has port different 80. looks this:

http://localhost:8080/assets/data/3641 

that return kmz file valid mime type, , can save , open in google earth if access link in browser.

google earth's api has following methods displaying kmz/kml:

  • kmlnetworklink - provide url of kmz/kml , attach object ge instance
  • parsekml() - provide kml string, gives kmlfeature attach
  • fetchkml() - provide url kml/kmz, attaches you
  • another handy method displaykml() google earth api utility library, uses fetchkml()

fetchkml()

my first attempt use fetchkml, gives no response - fails silently. i'm surprised considered normal behaviour plugin (why doesn't throw exception, or provide second callback handle errors?). method works fine if provide sample kmz in form:

http://localhost/somefile.kmz 

i believe issue fact first url password protected - redirect login screen if no login session present, , suspect google earth plugin doesn't share same browser session browser - runs login screen , fails because receives html file instead of kmz/kml.

parsekml()

pressing on undeterred, made api method unzip kmz on server side , return kml string:

http://localhost:8080/assets/data/unzip/3641 

the beauty of method write own javascript perform request - doesn't go through google earth, login session have opened used , kmz can downloaded. downfall kmzs can contain images , music kml file can reference. these can't passed along kml string far documentation concerned.

kmlnetworklink

my last attempt use kmlnetworklink , kmllink. has same effect fetchkml - nothing happens.

update: also, fail when using "https" without valid certificate.

yes issue url password protected. can fetchkml() give indication of error if use so:

google.earth.fetchkml(ge, 'http://localhost:8080/assets/data/3641 ', finishfetchkml);  function finishfetchkml(kmlobject) {   // check if kml fetched   if (kmlobject) {     // add fetched kml earth     currentkmlobject = kmlobject;   } else {     // settimeout prevents deadlock in browsers     settimeout(function() {       alert('bad or null kml.');     }, 0);   } } 

kml designed free open format - if wish use privately on secure system should @ using enterprise version of google earth plugin.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -