我有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>
答案 0 :(得分:0)
取决于您的目标受众群体。想要在互联网上或内部网站上与共享网络驱动器上的照片共享KMZ吗?
如果KMZ文件是本地的,并且相对于KMZ文件是包含所有照片的“文件”文件夹,那么它将在Google地球中正确显示。
如果您从网站提供KMZ文件并且文件是本地文件,那么它将无效。如果使用相对链接,图像必须与KML文件共存。
<img src="files/$[geotourism_points/PIC_NAME].png" alt="picture" .../>
如果您使用KML中的绝对网址到照片位置,那么KMZ将在您托管它的任何地方使用。
<img src="http://server/files/$[geotourism_points/PIC_NAME].png" alt="picture" .../>
替代方案是在KMZ中嵌入“files”文件夹和照片,以便KML和照片是自包含的。然后你可以在KML中使用相对链接。