kml标签不显示名称

时间:2012-01-12 01:05:16

标签: tags kml google-earth

生活救星,我无法显示使用GeoCommons生成的kml文件。 我有一个kml中的加利福尼亚邮政编码列表,我需要在气球和侧栏上显示名称(5位数),但显然kml无法读取名称标签...我把这里放了knl结构只有2个邮政编码边界,​​以显示你是否可以帮助我,谢谢

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name><![CDATA[test zip]]></name>
<description><![CDATA[]]></description>
<atom:author>
<atom:name></atom:name>
<atom:uri></atom:uri>
</atom:author>
<atom:contributor>
<atom:name>gustavo</atom:name>
<atom:uri>http://geocommons.com/users/gutibs</atom:uri>    
</atom:contributor>
<atom:rights>Creative Commons Attribution-Share Alike 2.0</atom:rights>   
<TimeStamp></TimeStamp>

  <!-- Poly Style -->

  <StyleMap id="default">
  <Pair>
    <key>normal</key>
    <styleUrl>#default_normal</styleUrl>
  </Pair>
  <Pair>
    <key>highlight</key>
    <styleUrl>#default_highlight</styleUrl>
  </Pair>
  </StyleMap>

<Style id="default_normal">
<IconStyle>
  <scale>1</scale>
  <Icon>
    <href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>
  </Icon>
</IconStyle>
<LabelStyle>
    <scale>0</scale>

    </LabelStyle>
    <LineStyle>
      <color>eeff6600</color>
      <width>3</width>

    </LineStyle>
    <PolyStyle>
      <color>99ff6600</color>
      <outline>1</outline>
      <fill>1</fill>
    </PolyStyle>
<BalloonStyle>
  <bgColor>ffffff</bgColor>
  <text>
    <![CDATA[
        <p><b><font color="#000000">$[NAME/displayName]:</font></b> </p>

    ]]>
  </text>
</BalloonStyle>
</Style>


<Style id="default_highlight">
<IconStyle>
  <scale>1</scale>
  <Icon>
        <href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href>
  </Icon>
</IconStyle>
<LabelStyle>
    <scale>0</scale>

    </LabelStyle>
    <LineStyle>
      <color>ddffffff</color>
      <width>2</width>

    </LineStyle>
    <PolyStyle>
      <color>ccff6600</color>
      <outline>1</outline>
      <fill>1</fill>
    </PolyStyle>
<BalloonStyle>
  <bgColor>ffffff</bgColor>
  <text>
    <![CDATA[
        <p><b><font color="#000000">$[NAME/displayName]:</font></b> </p>

    ]]>
  </text>
</BalloonStyle>
</Style>
      <Placemark>
  <styleUrl>#default</styleUrl>
    <name><![CDATA[Name:]]></name>

  <ExtendedData>
      <Data name='Name'>
        <displayName><![CDATA[Name]]></displayName>
        <value><![CDATA[94945]]></value>
      </Data>
  </ExtendedData>
  <MultiGeometry>
    <Polygon>
<outerBoundaryIs><LinearRing><coordinates>
-122.630295,38.150619 -122.630367,38.15195 -122.629376,38.154185 -122.628414,38.154871     -122.627026,38.157709 -122.630764,38.159456 -122.632595,38.166618 -122.627316,38.175447     -122.627926,38.176813 -122.625595,38.181318 -122.620114,38.181994 -122.617795,38.181818     -122.618969,38.178461 -122.618895,38.177118 -122.617871,38.176386 -122.610882,38.174387     -122.605037,38.173349 -122.599208,38.169764 -122.59785,38.16823 -122.594203,38.168604 -122.589494,38.172918 -122.599209,38.180375 -122.600502,38.182283 -122.600894,38.184618 -122.598094,38.187017 -122.593094,38.187217 -122.591494,38.186217 -122.590194,38.185917 -122.587901,38.18657 -122.586623,38.187843 -122.584514,38.188073 -122.574228,38.185945 -122.574893,38.183917 -122.57435,38.183526 -122.573237,38.183297 -122.570693,38.183517 -122.570643,38.184403 -122.572413,38.185258 -122.573176,38.185876 -122.573193,38.186317 -122.572504,38.187066 -122.570734,38.187142 -122.5702,38.186738 -122.569574,38.185288 -122.568506,38.184175 -122.565424,38.182939 -122.565093,38.182217 -122.566293,38.179417 -122.568171,38.177759 -122.568493,38.177018 -122.567621,38.176332 -122.564463,38.175081 -122.563993,38.173518 -122.564264,38.170694 -122.563193,38.169318 -122.560938,38.168749 -122.559243,38.168619 -122.55758,38.168978 -122.555581,38.169954 -122.554238,38.170122 -122.552651,38.169664 -122.55198,38.169001 -122.551965,38.168146 -122.552957,38.167032 -122.555993,38.165468 -122.557366,38.164377 -122.557992,38.16353 -122.558435,38.161974 -122.558373,38.161188 -122.557916,38.160158 -122.555917,38.158991 -122.549615,38.15729 -122.548532,38.157221 -122.547601,38.157473 -122.545693,38.158663 -122.544473,38.158716 -122.54371,38.158068 -122.541497,38.155184 -122.537697,38.151514 -122.534828,38.149202 -122.531563,38.14715 -122.523964,38.143511 -122.522223,38.142405 -122.519019,38.139742 -122.51529,38.135618 -122.513144,38.132235 -122.511832,38.128444 -122.51129,38.124919 -122.510458,38.123027 -122.507925,38.118098 -122.505549,38.115379 -122.501589,38.112319 -122.490743543307,38.1097066110743 -122.49128332021,38.1080872803655 -122.489974315556,38.096960715442 -122.488779715366,38.0944520434674 -122.490888,38.094219 -122.498788,38.09122 -122.504088,38.08542 -122.509688,38.08402 -122.514289,38.08682 -122.514789,38.09032 -122.516489,38.09172 -122.519506,38.090901 -122.523189,38.08762 -122.526998,38.088131 -122.528489,38.08772 -122.529104,38.086063 -122.528448,38.084011 -122.527288,38.082569 -122.527589,38.08222 -122.529608,38.082531 -122.531683,38.08392 -122.533163,38.085278 -122.533722,38.087695 -122.53429,38.08782 -122.540928,38.083113 -122.544178,38.081732 -122.547753,38.081495 -122.558991,38.09212 -122.561991,38.09022 -122.566491,38.09772 -122.576092,38.106919 -122.578492,38.106719 -122.578792,38.10632 -122.589693,38.111219 -122.587793,38.113819 -122.593593,38.116219 -122.599393,38.116719 -122.605693,38.116319 -122.609494,38.117819 -122.618194,38.119419 -122.625394,38.122419 -122.630795,38.119719 -122.631095,38.122019 -122.625294,38.123619 -122.622646,38.136806 -122.62965,38.141681 -122.632595,38.144458 -122.63258,38.147327 -122.631405,38.150004 -122.630295,38.150619
</coordinates></LinearRing></outerBoundaryIs>
</Polygon>
  </MultiGeometry>
</Placemark>
<Placemark>
  <styleUrl>#default</styleUrl>
    <name><![CDATA[Name:]]></name>

  <ExtendedData>
      <Data name='Name'>
        <displayName><![CDATA[Name]]></displayName>
        <value><![CDATA[94947]]></value>
      </Data>
  </ExtendedData>
  <MultiGeometry>
    <Polygon>
<outerBoundaryIs><LinearRing><coordinates>
-122.713698,38.11912 -122.715347,38.120922 -122.716155,38.123119 -122.712936,38.131077 -122.705598,38.142519 -122.699493,38.140704 -122.692244,38.145801 -122.683287,38.14915 -122.666944,38.148578 -122.664823,38.148135 -122.663434,38.146457 -122.661161,38.145473 -122.65286,38.148013 -122.64381,38.146495 -122.639538,38.146487 -122.63728,38.147166 -122.633221,38.149592 -122.630295,38.150619 -122.631405,38.150004 -122.63258,38.147327 -122.632595,38.144458 -122.62965,38.141681 -122.622646,38.136806 -122.625294,38.123619 -122.631095,38.122019 -122.630795,38.119719 -122.625394,38.122419 -122.618194,38.119419 -122.609494,38.117819 -122.605693,38.116319 -122.599393,38.116719 -122.593593,38.116219 -122.587793,38.113819 -122.589693,38.111219 -122.578792,38.10632 -122.578492,38.106719 -122.576092,38.106919 -122.566491,38.09772 -122.561991,38.09022 -122.558991,38.09212 -122.547753,38.081495 -122.543545,38.077607 -122.55609,38.07772 -122.559591,38.07872 -122.562391,38.08042 -122.565491,38.08102 -122.569191,38.07782 -122.568191,38.07472 -122.563291,38.06942 -122.56089,38.06792 -122.55829,38.06762 -122.55729,38.06692 -122.55939,38.06572 -122.56479,38.063221 -122.570091,38.061921 -122.57673,38.061123 -122.582491,38.062821 -122.590292,38.063121 -122.599658,38.056007 -122.599126,38.055733 -122.605092,38.058621 -122.600292,38.062621 -122.596992,38.067421 -122.601392,38.070221 -122.604193,38.07582 -122.615779,38.082894 -122.627894,38.08832 -122.630694,38.08882 -122.634194,38.08732 -122.640495,38.08702 -122.652981,38.089596 -122.663696,38.09362 -122.665357,38.095722 -122.665496,38.10402 -122.667493,38.112812 -122.673307,38.115299 -122.676069,38.115933 -122.687132,38.114254 -122.691511,38.114216 -122.696364,38.116413 -122.698744,38.120922 -122.699767,38.121609 -122.705428,38.123142 -122.713027,38.120205 -122.713698,38.11912
 </coordinates></LinearRing></outerBoundaryIs>
</Polygon>
  </MultiGeometry>
</Placemark>
<Placemark>
  <styleUrl>#default</styleUrl>
    <name><![CDATA[Name:]]></name>

  <ExtendedData>
      <Data name='Name'>
        <displayName><![CDATA[Name]]></displayName>
        <value><![CDATA[94949]]></value>
      </Data>
  </ExtendedData>
  <MultiGeometry>
    <Polygon>
<outerBoundaryIs><LinearRing><coordinates>
-122.488779715366,38.0944520434674 -122.488257693584,38.0933557926679 -122.486778070827,38.0902485705397 -122.486701803922,38.0900884093014 -122.486161424816,38.0867260616676 -122.483756524426,38.0717622870738 -122.484009371025,38.0713052182653 -122.492265080042,38.0563814380006 -122.492443217463,38.0557822483525 -122.494045825806,38.0503916553691 -122.494897664653,38.0475263785664 -122.497848,38.047834 -122.498287,38.047521 -122.506587,38.047721 -122.506504,38.046956 -122.507999,38.045301 -122.513987,38.044421 -122.51415,38.048673 -122.515447,38.051168 -122.520588,38.052621 -122.519288,38.039921 -122.521088,38.038421 -122.522546,38.038448 -122.525085,38.038715 -122.526165,38.039012 -122.526159,38.039752 -122.55469,38.047021 -122.573591,38.046421 -122.583291,38.050021 -122.588991,38.050521 -122.590192,38.053621 -122.599126,38.055733 -122.599658,38.056007 -122.590292,38.063121 -122.582491,38.062821 -122.57673,38.061123 -122.570091,38.061921 -122.56479,38.063221 -122.55939,38.06572 -122.55729,38.06692 -122.55829,38.06762 -122.56089,38.06792 -122.563291,38.06942 -122.568191,38.07472 -122.569191,38.07782 -122.565491,38.08102 -122.562391,38.08042 -122.559591,38.07872 -122.55609,38.07772 -122.543545,38.077607 -122.547753,38.081495 -122.544178,38.081732 -122.540928,38.083113 -122.53429,38.08782 -122.533722,38.087695 -122.533163,38.085278 -122.531683,38.08392 -122.529608,38.082531 -122.527589,38.08222 -122.527288,38.082569 -122.528448,38.084011 -122.529104,38.086063 -122.528489,38.08772 -122.526998,38.088131 -122.523189,38.08762 -122.519506,38.090901 -122.516489,38.09172 -122.514789,38.09032 -122.514289,38.08682 -122.509688,38.08402 -122.504088,38.08542 -122.498788,38.09122 -122.490888,38.094219 -122.488779715366,38.0944520434674
</coordinates></LinearRing></outerBoundaryIs>
</Polygon>
  </MultiGeometry>
</Placemark>
</Document>
</kml>

1 个答案:

答案 0 :(得分:0)

KML区分大小写。你的BalloonStyle看起来像这样:

<BalloonStyle>
  <bgColor>ffffff</bgColor>
  <text>
    <![CDATA[
        <p><b><font color="#000000">$[NAME/displayName]:</font></b> </p>

    ]]>
  </text>
</BalloonStyle>

应该是:

<BalloonStyle>
  <bgColor>ffffff</bgColor>
  <text>
    <![CDATA[
        <p><b><font color="#000000">$[Name/displayName]:</font></b> </p>

    ]]>
  </text>
</BalloonStyle>

我测试了它,它对我有用