0

对于存储在本地驱动器上的每个点,我有 100 个点有一张照片。每个点都有扩展数据,其中包括图片名称的根(bee-tree)

我设置了使用以下行来引用:img src="/files/$[geotourism_points/PIC_NAME].png",当我将它保存为 kml 时它可以工作。但是,当我将其保存为 .kmz 时,它会忽略 $[geotourism_points/ 并且只返回 img src="files/PIC_NAME].png"

我尝试使用 ../files/image.png、/files/image.png、files/image.png 使用相对路径名(你使用哪一个?!!)

我仍然无法让它工作。我可以通过这种方式将图像插入我的气球(本地文件),还是必须将它们加载到服务器并使用 URL 引用它们?

在此先感谢您的帮助!

这是整个代码:

    <?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
    <name>KmlFile</name>
    <Schema name="geotourism_points" id="geotourism_points_schema">
        <SimpleField type="string" name="MO_REGIO_1"><displayName>&lt;b&gt;MO_REGIO_1&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="TYPE"><displayName>&lt;b&gt;TYPE&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="NOTES_1"><displayName>&lt;b&gt;NOTES_1&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="WEBSITE"><displayName>&lt;b&gt;WEBSITE&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="SITE_NAME"><displayName>&lt;b&gt;SITE_NAME&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="LINK_2"><displayName>&lt;b&gt;LINK_2&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="ADDRESS"><displayName>&lt;b&gt;ADDRESS&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="PHONE"><displayName>&lt;b&gt;PHONE&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="PIC_NAME"><displayName>&lt;b&gt;PIC_NAME&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="string" name="SOURCE_1"><displayName>&lt;b&gt;SOURCE_1&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="int" name="NATUR"><displayName>&lt;b&gt;NATUR&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="int" name="CULTU"><displayName>&lt;b&gt;CULTU&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="int" name="REC"><displayName>&lt;b&gt;REC&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="int" name="ARCHEO"><displayName>&lt;b&gt;ARCHEO&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="int" name="HIST"><displayName>&lt;b&gt;HIST&lt;/b&gt;</displayName>
</SimpleField>
        <SimpleField type="double" name="OBJECTID"><displayName>&lt;b&gt;OBJECTID&lt;/b&gt;</displayName>
</SimpleField>
    </Schema>
    <StyleMap id="pointStyleMap">
        <Pair>
            <key>normal</key>
            <styleUrl>#normPointStyle</styleUrl>
        </Pair>
        <Pair>
            <key>highlight</key>
            <styleUrl>#normPointStyle0</styleUrl>
        </Pair>
    </StyleMap>
    <Style id="normPointStyle0">
        <IconStyle>
            <Icon>
                <href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>
            </Icon>
        </IconStyle>
        <BalloonStyle>
            <text><![CDATA[<table width="350"  cellpadding="1" cellspacing="0">
  <tr>
    <td colspan="3" align="center" valign="top">
      <table  border="0" width="100%" cellpadding="1" cellspacing="0">
        <tr>
          <td align="left" valign="top">
            <img src="files/lecl_logo.png" alt="logo"/>
          </td>
          <td width="70%"" align="left" valign="bottom">
            <font color="#2f4f4f" size="+2"><strong>$[geotourism_points/SITE_NAME]</strong></font>
            <br>
            <font color="#999999"><em>$[geotourism_points/TYPE] </em></font>
            <hr/>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="40%" align="left" valign="top">
      <p>
        <br>
        <font color="#666666"><strong>Visitor's Information:</strong></font>
        <br><br>
        <font color="#999999">$[geotourism_points/ADDRESS]<br>$[geotourism_points/PHONE]</font>
      </p>
      <p>
        <a href="$[geotourism_points/WEBSITE]" target="_blank"><strong><em><font color="#2f4f4f">More Information...</font></strong></em></a>
      </p>
    </td>
    <td align="left" valign="top">
      <table border="0" cellspacing="0" cellpadding="3" bgcolor="white">
        <tr>
          <td align="center"><img src="files/$[geotourism_points/PIC_NAME].png" alt="picture" width="100%" align="left" valign="middle"/></td>
        </tr>   
        <tr>
          <td colspan="3" align="right"><font color="#999999" size="-1">$[geotourism_points/SOURCE_1]</font></td>
        </tr>
     </td>
</table>]]></text>
        </BalloonStyle>
    </Style>
    <Style id="normPointStyle">
        <IconStyle>
            <Icon>
                <href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>
            </Icon>
        </IconStyle>
        <BalloonStyle>
            <text><![CDATA[<table width="350"  cellpadding="1" cellspacing="0">
  <tr>
    <td colspan="3" align="center" valign="top">
      <table  border="0" width="100%" cellpadding="1" cellspacing="0">
        <tr>
          <td align="left" valign="top">
            <img src="files/lecl_logo.png" alt="logo"/>
          </td>
          <td width="70%"" align="left" valign="bottom">
            <font color="#2f4f4f" size="+2"><strong>$[geotourism_points/SITE_NAME]</strong></font>
            <br>
            <font color="#999999"><em>$[geotourism_points/TYPE] </em></font>
            <hr/>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="40%" align="left" valign="top">
      <p>
        <br>
        <font color="#666666"><strong>Visitor's Information:</strong></font>
        <br><br>
        <font color="#999999">$[geotourism_points/ADDRESS]<br>$[geotourism_points/PHONE]</font>
      </p>
      <p>
        <a href="$[geotourism_points/WEBSITE]" target="_blank"><strong><em><font color="#2f4f4f">More Information...</font></strong></em></a>
      </p>
    </td>
    <td align="left" valign="top">
      <table border="0" cellspacing="0" cellpadding="3" bgcolor="white">
        <tr>
          <td align="center"><img src="files/$[geotourism_points/PIC_NAME].png" alt="picture" width="100%" align="left" valign="middle"/></td>
        </tr>   
        <tr>
          <td colspan="3" align="right"><font color="#999999" size="-1">$[geotourism_points/SOURCE_1]</font></td>
        </tr>
     </td>
</table>]]></text>
        </BalloonStyle>
    </Style>
    <Folder id="layer 0">
        <name>geotourism_points</name>
        <open>1</open>
        <Placemark>
            <name>Bee Tree County Park</name>
            <styleUrl>#pointStyleMap</styleUrl>
            <ExtendedData>
                <SchemaData schemaUrl="#geotourism_points_schema">
                    <SimpleData name="MO_REGIO_1">Confluence Region</SimpleData>
                    <SimpleData name="TYPE">City/County Park</SimpleData>
                    <SimpleData name="NOTES_1">riverfront</SimpleData>
                    <SimpleData name="WEBSITE">stlouisco.com/ParksandRecreation/ParkPages/BeeTree</SimpleData>
                    <SimpleData name="SITE_NAME">Bee Tree County Park</SimpleData>
                    <SimpleData name="LINK_2"></SimpleData>
                    <SimpleData name="ADDRESS">2701 Finestown Road Saint Louis, MO 63129</SimpleData>
                    <SimpleData name="PHONE"></SimpleData>
                    <SimpleData name="PIC_NAME">bee-tree</SimpleData>
                    <SimpleData name="SOURCE_1">stlouisco.com</SimpleData>
                    <SimpleData name="NATUR">1</SimpleData>
                    <SimpleData name="CULTU">0</SimpleData>
                    <SimpleData name="REC">1</SimpleData>
                    <SimpleData name="ARCHEO">0</SimpleData>
                    <SimpleData name="HIST">0</SimpleData>
                    <SimpleData name="OBJECTID">234</SimpleData>
                </SchemaData>
            </ExtendedData>
            <Point>
                <coordinates>-90.32844745921075,38.40766261103909,0</coordinates>
            </Point>
        </Placemark>
        <Placemark>
            <name>Old St. Ferdinand Shrine</name>
            <styleUrl>#pointStyleMap</styleUrl>
            <ExtendedData>
                <SchemaData schemaUrl="#geotourism_points_schema">
                    <SimpleData name="MO_REGIO_1">Confluence Region</SimpleData>
                    <SimpleData name="TYPE">Historic Site</SimpleData>
                    <SimpleData name="NOTES_1"></SimpleData>
                    <SimpleData name="WEBSITE">http://www.oldstferdinandshrine.com/</SimpleData>
                    <SimpleData name="SITE_NAME">Old St. Ferdinand Shrine</SimpleData>
                    <SimpleData name="LINK_2"></SimpleData>
                    <SimpleData name="ADDRESS">#1 rue St. Francois, Florissant MO 63031</SimpleData>
                    <SimpleData name="PHONE">Phone: (314) 837-2110</SimpleData>
                    <SimpleData name="PIC_NAME">old-st-ferdinand-shrine</SimpleData>
                    <SimpleData name="SOURCE_1">viewfrombackpew.blogspot.com</SimpleData>
                    <SimpleData name="NATUR">0</SimpleData>
                    <SimpleData name="CULTU">0</SimpleData>
                    <SimpleData name="REC">0</SimpleData>
                    <SimpleData name="ARCHEO">0</SimpleData>
                    <SimpleData name="HIST">1</SimpleData>
                    <SimpleData name="OBJECTID">269</SimpleData>
                </SchemaData>
            </ExtendedData>
            <Point>
                <coordinates>-90.33389390094645,38.79675526749391,0</coordinates>
            </Point>
        </Placemark>
    </Folder>
</Document>
</kml>
4

1 回答 1

0

取决于你的目标受众。是否想在 Internet 或内部网站上共享 KMZ 以及共享网络驱动器上的照片等?

如果 KMZ 文件是本地文件,并且相对于 KMZ 文件是包含所有照片的文件夹“文件”,那么它将按原样在 Google 地球中正确显示。

如果您从网站提供 KMZ 文件并且文件是本地文件,那么它将无法工作。如果使用相对链接,图像必须与 KML 文件共存。

<img src="files/$[geotourism_points/PIC_NAME].png" alt="picture" .../>

如果您在 KML 中使用绝对 URL 指向照片位置,那么 KMZ 将在您托管它的任何地方工作。

<img src="http://server/files/$[geotourism_points/PIC_NAME].png" alt="picture" .../>

另一种方法是在 KMZ 中嵌入“文件”文件夹和照片,以便 KML 和照片是独立的。然后您可以在 KML 中使用相对链接。

于 2013-10-25T14:17:41.840 回答