Search code examples
xmlpopupkmlgoogle-earthshapefile

Can't customize popup from google earth of imported shapefile


I've imported a shapefile in google earth and I want to display an image with the popup, but althoug I add the image in the description, it's not showed up in the popup and only displays the info of the shape fields.

How can I add the image?

If I edit with the notepad, I can see the image is suposed to be there.

<Placemark>
                <name>Carlos arrepiche</name>
                <description><![CDATA[<img src="https://www.dropbox.com/s/b4bna1w3yrwzgqs/CARLOS%20ARREPICHE%20.jpeg?dl=0"/>]]></description>
                <styleUrl>#pointStyleMap1</styleUrl>
                <ExtendedData>
                    <SchemaData schemaUrl="#S_Casas_Victoria_ISSSISDDS">
                        <SimpleData name="ITM">64</SimpleData>
                        <SimpleData name="Nombre">Carlos arrepiche</SimpleData>
                        <SimpleData name="Etnia">ACHAGUA</SimpleData>
                        <SimpleData name="Tipo_casa">NO TRADICIONAL</SimpleData>
                        <SimpleData name="Habitantes">6</SimpleData>
                        <SimpleData name="Familia">EXTENSA</SimpleData>
                        <SimpleData name="x">1.19636e+06</SimpleData>
                        <SimpleData name="y">966309</SimpleData>
                        <SimpleData name="Imagen">https://www.dropbox.com/s/b4bna1w3yrwzgqs/CARLOS%20ARREPICHE%20.jpeg?dl=0</SimpleData>
                    </SchemaData>
                </ExtendedData>
                <Point>
                    <coordinates>-72.30895670000614,4.289474999999894,0</coordinates>
                </Point>
</Placemark>

The image I want to display is the one in the description, I'm aware that the simple data image is only the link. Have I to insert something manually at the code? Like in the ballonstyle or something?

    <BalloonStyle>
            <text><![CDATA[<table border="0">
  <tr><td><b>ITM</b></td><td>$[Casas_Victoria/ITM]</td></tr>
  <tr><td><b>Nombre</b></td><td>$[Casas_Victoria/Nombre]</td></tr>
  <tr><td><b>Etnia</b></td><td>$[Casas_Victoria/Etnia]</td></tr>
  <tr><td><b>Tipo casa</b></td><td>$[Casas_Victoria/Tipo_casa]</td></tr>
  <tr><td><b>Habitantes</b></td><td>$[Casas_Victoria/Habitantes]</td></tr>
  <tr><td><b>Familia</b></td><td>$[Casas_Victoria/Familia]</td></tr>
  <tr><td><b>x</b></td><td>$[Casas_Victoria/x]</td></tr>
  <tr><td><b>y</b></td><td>$[Casas_Victoria/y]</td></tr>
  <tr><td><b>Imagen</b></td><td>$[Casas_Victoria/Imagen]</td></tr>
</table>]]></text>
        </BalloonStyle>

I've tried to change the image location into the Imagen but didn't work

<Placemark>
                    <name>Carlos arrepiche</name>
                    <styleUrl>#pointStyleMap1</styleUrl>
                    <ExtendedData>
                        <SchemaData schemaUrl="#S_Casas_Victoria_ISSSISDDS">
                            <SimpleData name="ITM">64</SimpleData>
                            <SimpleData name="Nombre">Carlos arrepiche</SimpleData>
                            <SimpleData name="Etnia">ACHAGUA</SimpleData>
                            <SimpleData name="Tipo_casa">NO TRADICIONAL</SimpleData>
                            <SimpleData name="Habitantes">6</SimpleData>
                            <SimpleData name="Familia">EXTENSA</SimpleData>
                            <SimpleData name="x">1.19636e+06</SimpleData>
                            <SimpleData name="y">966309</SimpleData>
                            <SimpleData name="Imagen"><![CDATA[<img src="https://www.dropbox.com/s/b4bna1w3yrwzgqs/CARLOS%20ARREPICHE%20.jpeg?dl=0"/>]]></SimpleData>
                        </SchemaData>
                    </ExtendedData>
                    <Point>
                        <coordinates>-72.30895670000614,4.289474999999894,0</coordinates>
                    </Point>
                </Placemark>

enter image description here


Solution

  • If want to use the URL value of an SimpleData element in an inline image in the balloon description popup then must place the <img> tag in the BalloonStyle not in the SimpleData value.

    Here's the updated style.

    <Style id="pointStyleMap1">
       <BalloonStyle>
                <text><![CDATA[<table border="0">
      <tr><td><b>ITM</b></td><td>$[Casas_Victoria/ITM]</td></tr>
      <tr><td><b>Nombre</b></td><td>$[Casas_Victoria/Nombre]</td></tr>
      <tr><td><b>Etnia</b></td><td>$[Casas_Victoria/Etnia]</td></tr>
      <tr><td><b>Tipo casa</b></td><td>$[Casas_Victoria/Tipo_casa]</td></tr>
      <tr><td><b>Habitantes</b></td><td>$[Casas_Victoria/Habitantes]</td></tr>
      <tr><td><b>Familia</b></td><td>$[Casas_Victoria/Familia]</td></tr>
      <tr><td><b>x</b></td><td>$[Casas_Victoria/x]</td></tr>
      <tr><td><b>y</b></td><td>$[Casas_Victoria/y]</td></tr>
      <tr><td><b>Imagen</b></td><td><img src="$[Casas_Victoria/Imagen]"/></td></tr>
    </table>]]></text>
       </BalloonStyle>
    </Style>
    

    Here's the updated ExtendedData for the Placemark:

      <Placemark>
       <ExtendedData>
          <SchemaData schemaUrl="#S_Casas_Victoria_ISSSISDDS">
             ...
             <SimpleData name="Imagen"><![CDATA[https://www.dropbox.com/s/b4bna1w3yrwzgqs/CARLOS%20ARREPICHE%20.jpeg?dl=0]]></SimpleData>
          </SchemaData>
       </ExtendedData>
     </Placemark>
    

    This assumes that the image URL is available but the URL in original question is no longer available.