我有100個點,有存儲在我的本地驅動器上的每個點的照片。每個點都有擴展的數據,其中包括圖片名稱的根(蜂樹)在谷歌地球中使用本地圖像
我有我的設置引用使用此行: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><b>MO_REGIO_1</b></displayName>
</SimpleField>
<SimpleField type="string" name="TYPE"><displayName><b>TYPE</b></displayName>
</SimpleField>
<SimpleField type="string" name="NOTES_1"><displayName><b>NOTES_1</b></displayName>
</SimpleField>
<SimpleField type="string" name="WEBSITE"><displayName><b>WEBSITE</b></displayName>
</SimpleField>
<SimpleField type="string" name="SITE_NAME"><displayName><b>SITE_NAME</b></displayName>
</SimpleField>
<SimpleField type="string" name="LINK_2"><displayName><b>LINK_2</b></displayName>
</SimpleField>
<SimpleField type="string" name="ADDRESS"><displayName><b>ADDRESS</b></displayName>
</SimpleField>
<SimpleField type="string" name="PHONE"><displayName><b>PHONE</b></displayName>
</SimpleField>
<SimpleField type="string" name="PIC_NAME"><displayName><b>PIC_NAME</b></displayName>
</SimpleField>
<SimpleField type="string" name="SOURCE_1"><displayName><b>SOURCE_1</b></displayName>
</SimpleField>
<SimpleField type="int" name="NATUR"><displayName><b>NATUR</b></displayName>
</SimpleField>
<SimpleField type="int" name="CULTU"><displayName><b>CULTU</b></displayName>
</SimpleField>
<SimpleField type="int" name="REC"><displayName><b>REC</b></displayName>
</SimpleField>
<SimpleField type="int" name="ARCHEO"><displayName><b>ARCHEO</b></displayName>
</SimpleField>
<SimpleField type="int" name="HIST"><displayName><b>HIST</b></displayName>
</SimpleField>
<SimpleField type="double" name="OBJECTID"><displayName><b>OBJECTID</b></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>
我將從一個網站分享KMZ。我以爲我通過將kml保存爲kmz來嵌入KMZ中的「files」文件夾。但它打破了實體替換/files/$[geotourism_points/PIC_NAME].png「並將其更改爲」files/PIC_NAME] .png「,因此找不到相對路徑。看起來最容易創建URL。感謝您的回覆! – user2918490
爲什麼它會破壞路徑名?我找不到解決方法。我嘗試使用filezilla來提供圖像,但是這只是帶來了一大堆其他問題。 – user2918490
嘗試使用src =「 ./files/...此外,將.kmz重命名爲.zip,然後將「files」文件夾添加爲zip文件,然後將其重命名爲.kmz。現在它工作? – JasonM1