Cannot load images in KML Descriptions?

1741
9
Jump to solution
12-11-2020 12:18 PM
andrewowenlinquest
New Contributor II

So, I'm using ArcGIS Earth as a KML viewer. The KML in question is behind a site securing using client certificates, and when I try loading images in placemarks using an `img` tag, it merely shows a placeholder image indicating that it wasn't able to load the image. 

So, my question is twofold: 1) Is there a way to access images in KML descriptions that will use the authentication prompted by the server? 2) Is there a general means of debugging how ArcGIS deals with failure to load resources? I know in Google Earth Enterprise, there is a bit of ability to view a networking console.

0 Kudos
2 Solutions

Accepted Solutions
andrewowenlinquest
New Contributor II

So, I wasn't able to get ArcGIS Earth to send auth along with the image requests, but I was able to embed the images in the KML using an SVG tag in the description, using an image tag inside that, and putting the image data in a data: URL. Documenting that here in case anyone runs into similar issues.

View solution in original post

0 Kudos
andrewowenlinquest
New Contributor II

YongweiKang,

Below is an example of how it'd look. The base64 data would need to be for a valid PNG image

<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document id="ExampleDocument">
    <name>Example KML Document</name>
    <snippet></snippet>
    <description><![CDATA[ Example description ]]></description>
    <Placemark id="ExamplePlacemark">
      <name>GPS Accuracy Prediction</name>
      <snippet></snippet>
      <description><![CDATA[
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="480" width="640" >
          <image xlink:href="data&colon;image/png;base64,base64datahere==" />
        </svg>
          ]]></description>
    </Placemark>
  </Document>
</kml>

View solution in original post

9 Replies
andrewowenlinquest
New Contributor II

So, the core issue seems to be that ArcGIS Earth doesn't add auth to requests for images that are used in Placemark Descriptions? Has anyone else seen this, and, if so, what would one do about it?

0 Kudos
andrewowenlinquest
New Contributor II

So, I wasn't able to get ArcGIS Earth to send auth along with the image requests, but I was able to embed the images in the KML using an SVG tag in the description, using an image tag inside that, and putting the image data in a data: URL. Documenting that here in case anyone runs into similar issues.

0 Kudos
YongweiKang
Esri Contributor

Could you help provide a sample to explain your workaround?  Thanks!

0 Kudos
andrewowenlinquest
New Contributor II

YongweiKang,

Below is an example of how it'd look. The base64 data would need to be for a valid PNG image

<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document id="ExampleDocument">
    <name>Example KML Document</name>
    <snippet></snippet>
    <description><![CDATA[ Example description ]]></description>
    <Placemark id="ExamplePlacemark">
      <name>GPS Accuracy Prediction</name>
      <snippet></snippet>
      <description><![CDATA[
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="480" width="640" >
          <image xlink:href="data&colon;image/png;base64,base64datahere==" />
        </svg>
          ]]></description>
    </Placemark>
  </Document>
</kml>
YongweiKang
Esri Contributor

Hi @andrewowenlinquest 

Thanks for the question. I'm glad you found a solution.

1) Is there a way to access images in KML descriptions that will use the authentication prompted by the server?

Which version of ArcGIS Earth did you use? Please try with the latest version 1.11.

2) Is there a general means of debugging how ArcGIS deals with failure to load resources?

We will consider providing developer tools in the next release.

 

Best,

Yongwei

0 Kudos
andrewowenlinquest
New Contributor II

I'm using ArcGIS Earth 1.11 Build 2902, built on 9/21/2020. I downloaded it last week. 

While I'm thinking about it: I think the HTML descriptions in KML placemarks use a different HTTP client/setup than the one that does KML network links. Or, at a minimum, selecting an HTTPS client certificate doesn't seem to propagate for requests made on behalf of the HTML client. I've observed similar behavior for Images behind HTTP Basic Auth, where I don't have an opportunity to provide credentials to placemark image requests.

 

0 Kudos
YongweiKang
Esri Contributor

Yes, the process of the HTTP request in the HTML description and the request in the KML network links are different. The requests in the HTML description are processed by Popup (Embed Web Browser), and the client certificate didn't pass to the Popup.

And I want to know what authentication type is the image request in the HTML description? 

Can you provide a test KML for us?

 

Thanks,

Yongwei

0 Kudos
andrewowenlinquest
New Contributor II

Well, it's not just a test KML, it's also that a description in the KML references images that are behind auth. 

HTTP Basic Auth is enough to stop the images from loading in the Popup. I've also seen HTTPS Client Certificate Authentication fail to work. 

I can't provide a test KML to demonstrate the problem, because the problem is in the interaction between KML and a server, and the code I'm working with that led to me figuring this out is proprietary, and I don't currently have time to write an example server that demonstrates the problem. 

0 Kudos
YongweiKang
Esri Contributor

Hi @andrewowenlinquest 

Thank you very much for your detailed feedback, it is enough for us to locate this issue. 

Best,

Yongwei

0 Kudos