kml layers that use web style icons in a disconnected system

187
3
Jump to solution
11-30-2022 04:51 AM
Labels (2)
TroyFoster
Occasional Contributor

So a coworker gave me a kml file to display in my disconnected system and that kml file refers to symbols from web icons. 

So I modified the sample from https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Layers/Dis... and put the kml as the local file to load. 

In my disconnected system the icon does not end up being correct, just a red X.  I know that the symbols used will be fairly limited and I should be able to pre-cache them somewhere in my system. 

Is there a way to have some sort of configuration mapping saying that if it is looking for a certain weburl to actually load a certain local file?

This is on Runtime Qt 100.14, 

sample picture:

TroyFoster_0-1669812467490.png

 

simplified kml snippet:

 

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
  <Document>
    <name>foo</name>
    <Folder>
      <name>foo Points</name>
      <Style id="fooPoint">
        <IconStyle>
          <scale>0.5</scale>
          <Icon>
            <href>https://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle_blue.png</href>
          </Icon>
          <hotspot x=".5" xunits="fraction" y=".5" yunits="fraction"/>
        </IconStyle>
      </Style>
      <Placemark>
        <name>Foo</name>
        <description><![CDATA[<h1>Hello Esri!</h1>]]></description>
        <TimeStamp>
          <when>1980-01-01T00:01:01Z</when>
        </TimeStamp>
        <styleUrl>#fooPoint</styleUrl>
        <Point>
          <coordinates>-70.000000,30.0000000,0.00000000</coordinates>
          <altitudeMode>absolute</altitudeMode>
        </Point>
      </Placemark>
    </Folder>
  </Document>
</kml>

 

 

0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Contributor

Hi @TroyFoster. First, sorry for the delay in getting back to you. We've been busy preparing our first Qt 6 release, which is coming very soon.

I looked at your code and situation, and I don't know if there is any way to map those online urls to a local cache. However, I did find that with 100.14 I was able to load them up on my mac with local paths once I downloaded the files.

See below.

Screen Shot 2022-12-12 at 1.55.03 PM.png

Let me know if that works for you.

View solution in original post

0 Kudos
3 Replies
TroyFoster
Occasional Contributor

Adding more onto this, when I traverse the kml nodes, the "foo Points" folder node, its style ends up being a nullptr when the kml is loaded.  When I traverse to the placemark node I can see that for the placemark the style is iconStyle but changing the url for the icon does not seem to affect the drawing of the symbol.

0 Kudos
JamesBallard1
Esri Contributor

Hi @TroyFoster. First, sorry for the delay in getting back to you. We've been busy preparing our first Qt 6 release, which is coming very soon.

I looked at your code and situation, and I don't know if there is any way to map those online urls to a local cache. However, I did find that with 100.14 I was able to load them up on my mac with local paths once I downloaded the files.

See below.

Screen Shot 2022-12-12 at 1.55.03 PM.png

Let me know if that works for you.

0 Kudos
TroyFoster
Occasional Contributor

I think that is what I am going to end up doing, have the icon png files downloaded local and have a sed script do a search and replace of the web addresses with local paths, then have the map load in the modified kml file.