2015-11-02 115 views
-1

我開發了一個應用程序,其中數據從我們的數據庫中提取,並通過生成kml文件在Google Earth上顯示不同的多邊形。地標圖標未顯示在Google地球上!我哪裏出錯了?

我能夠做各種事情,如顯示多邊形,顯示帶有名稱和描述的地標,但無法顯示多邊形上的圖標圖像。

我已經檢查了記事本中的kml,它以正確的格式生成。

我不明白我在哪裏出錯,爲什麼我的地標圖標未顯示在我的Google地球軟件中。

在這裏,我張貼我的整個kml代碼。 您可以將它複製到記事本中並將其保存爲kml。

注意: - Google地球軟件安裝在我的電腦中,通過它我可以查看下載的KML文件。 請在這方面幫助我。 感謝你。

問候, BhanuChandra

<?xml version="1.0" encoding="utf-8"?> 
<kml xmlns="http://www.opengis.net/kml/2.2"> 
    <Document> 
     <Style id="bsr"> 
     <IconStyle> 
      <scale>1.5</scale> 
      <Icon> 
       <href>http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png</href> 
      </Icon> 
     </IconStyle> 
     <LineStyle> 
      <width>3</width> 
      <color>ff0000ff</color> 
      <colorMode>random</colorMode> 
     </LineStyle> 
     <PolyStyle> 
      <color>51400FF</color> 
      <LabelStyle> 
       <color>7fffaaff</color> 
       <scale>1.5</scale> 
      </LabelStyle> 
     </PolyStyle> 
     </Style> 
     <Placemark> 
     <styleUrl>#bsr</styleUrl> 
     <name>Near Subbaraopally Village</name> 
     <description><![CDATA[<b>Circle : </b>Adilabad<br/><b>Division : </b>Bellampally<br/><b>Range : </b>Bellampally<br/><b>Year : </b>2015<br/><b>Type : </b>Block<br/><b>Planting Method : </b>Labour Intensive(AR)<hr><br/><font color=LightSlateGray size = 1>ID : 108</font>]]></description> 
     <MultiGeometry> 
      <Polygon> 
       <extrude>1</extrude> 
       <tessellate>1</tessellate> 
       <altitudeMode>ALTITUDE_CLAMP_TO_GROUND</altitudeMode> 
       <outerBoundaryIs> 
        <LinearRing> 
        <coordinates>79.49749,19.02856,0 79.49763,19.02929,0 79.49739,19.02944,0 79.4979,19.0311,0 79.49628,19.03258,0 79.5002,19.0356,0 79.5007,19.0342,0 79.50138,19.03229,0 79.4997,19.03065,0 79.49749,19.02856,0 </coordinates> 
        </LinearRing> 
       </outerBoundaryIs> 
      </Polygon> 
     </MultiGeometry> 
     </Placemark> 
     <Placemark> 
     <styleUrl>#bsr</styleUrl> 
     <name>Bamboo with Misc 5x5 Bamboo (2.5x2.5 Misc) 10 Ha Near Gangaram Nagar</name> 
     <description><![CDATA[<b>Circle : </b>Adilabad<br/><b>Division : </b>Bellampally<br/><b>Range : </b>Bellampally<br/><b>Year : </b>2015<br/><b>Type : </b>Block<br/><b>Planting Method : </b>Semi Mechanical(AR)<hr><br/><font color=LightSlateGray size = 1>ID : 350599</font>]]></description> 
     <MultiGeometry> 
      <Polygon> 
       <extrude>1</extrude> 
       <tessellate>1</tessellate> 
       <altitudeMode>ALTITUDE_CLAMP_TO_GROUND</altitudeMode> 
       <outerBoundaryIs> 
        <LinearRing> 
        <coordinates>79.46981,19.07547,0 79.46986,19.07352,0 79.46985,19.07323,0 79.46861,19.07353,0 79.46556,19.07297,0 79.46554,19.07353,0 79.46607,19.07423,0 79.46693,19.07483,0 79.4679,19.0748,0 79.46785,19.07613,0 79.4698,19.07641,0 79.46981,19.07547,0 </coordinates> 
        </LinearRing> 
       </outerBoundaryIs> 
      </Polygon> 
     </MultiGeometry> 
     </Placemark> 
     <Placemark> 
     <styleUrl>#bsr</styleUrl> 
     <name>Misc. Plantation at Waripet</name> 
     <description><![CDATA[<b>Circle : </b>Adilabad<br/><b>Division : </b>Bellampally<br/><b>Range : </b>Bellampally<br/><b>Year : </b>2015<br/><b>Type : </b>Block<br/><b>Planting Method : </b>Labour Intensive(AR)<hr><br/><font color=LightSlateGray size = 1>ID : 350782</font>]]></description> 
     <MultiGeometry> 
      <Polygon> 
       <extrude>1</extrude> 
       <tessellate>1</tessellate> 
       <altitudeMode>ALTITUDE_CLAMP_TO_GROUND</altitudeMode> 
       <outerBoundaryIs> 
        <LinearRing> 
        <coordinates>79.43114,19.05873,0 79.43082,19.05947,0 79.43044,19.06048,0 79.42989,19.0615,0 79.42976,19.06282,0 79.42985,19.06278,0 79.43007,19.06333,0 79.4304,19.06406,0 79.43073,19.06469,0 79.43098,19.06514,0 79.43174,19.06511,0 79.43106,19.06442,0 79.43066,19.06397,0 79.43061,19.06345,0 79.43005,19.06156,0 79.43132,19.05964,0 79.4313,19.05883,0 79.43114,19.05873,0 </coordinates> 
        </LinearRing> 
       </outerBoundaryIs> 
      </Polygon> 
     </MultiGeometry> 
     </Placemark> 
     <Placemark> 
     <styleUrl>#bsr</styleUrl> 
     <name>Misc. Plantation at VSS Waripet</name> 
     <description><![CDATA[<b>Circle : </b>Adilabad<br/><b>Division : </b>Bellampally<br/><b>Range : </b>Bellampally<br/><b>Year : </b>2015<br/><b>Type : </b>Block<br/><b>Planting Method : </b>Semi Mechanical(AR)<hr><br/><font color=LightSlateGray size = 1>ID : 350783</font>]]></description> 
     <MultiGeometry> 
      <Polygon> 
       <extrude>1</extrude> 
       <tessellate>1</tessellate> 
       <altitudeMode>ALTITUDE_CLAMP_TO_GROUND</altitudeMode> 
       <outerBoundaryIs> 
        <LinearRing> 
        <coordinates>79.43598,19.06411,0 79.43665,19.0637,0 79.43723,19.06328,0 79.43742,19.06237,0 79.43725,19.06227,0 79.43741,19.06162,0 79.43762,19.06168,0 79.43788,19.06087,0 79.43873,19.05984,0 79.43935,19.05886,0 79.43988,19.05789,0 79.43965,19.05784,0 79.43924,19.05835,0 79.43835,19.05918,0 79.43786,19.05967,0 79.43732,19.06053,0 79.43686,19.06133,0 79.43709,19.06148,0 79.43687,19.06222,0 79.43647,19.06213,0 79.43648,19.06247,0 79.43614,19.0634,0 79.43954,19.05254,0 79.43944,19.05298,0 79.43923,19.05334,0 79.43926,19.05383,0 79.43931,19.05415,0 79.43893,19.05488,0 79.43867,19.05509,0 79.43887,19.05533,0 79.43886,19.05543,0 79.43893,19.05592,0 79.43939,19.05605,0 79.43974,19.05604,0 79.43945,19.05522,0 79.43949,19.05503,0 79.43952,19.05487,0 79.43948,19.05458,0 79.43948,19.05444,0 79.4395,19.05405,0 79.43958,19.05375,0 79.43974,19.05278,0 79.43975,19.05255,0 79.43598,19.06411,0 </coordinates> 
        </LinearRing> 
       </outerBoundaryIs> 
      </Polygon> 
     </MultiGeometry> 
     </Placemark> 
    </Document> 
</kml> 
+0

[Your KML](http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.geocodezip.com%2Fgeoxml3_test%2Fkml%2FSO_20151102.kml)無效 – geocodezip

回答

1

首要的問題是要顯示一個圖標和標籤同時使用多邊形需要一個點出現在MultiGeometry旁邊的多邊形內。如果地標幾何體是多邊形,那麼圖標和標籤將不會出現在地圖上 - 需要一個點。

下面是第一地標這樣的幾何形狀的一個示例:

<MultiGeometry> 
    <Point> 
     <coordinates>79.49883,19.03208</coordinates> 
    </Point> 
    <Polygon> 
     <extrude>1</extrude> 
     <tessellate>1</tessellate> 
     <outerBoundaryIs> 
      <LinearRing> 
      <coordinates>79.49749,19.02856,0 79.49763,19.02929,0 79.49739,19.02944,0 79.4979,19.0311,0 79.49628,19.03258,0 79.5002,19.0356,0 79.5007,19.0342,0 79.50138,19.03229,0 79.4997,19.03065,0 79.49749,19.02856,0 </coordinates> 
      </LinearRing> 
     </outerBoundaryIs> 
    </Polygon> 
</MultiGeometry> 

也有在KML一些小錯誤。首先,LabelStyle位於PolyStyle元素中。接下來,altitudeMode值無效:ALTITUDE_CLAMP_TO_GROUND必須更改爲clampToGround

+0

非常感謝。它爲我工作。 –

相關問題