谷歌地图网页API - KML IconStyle颜色不工作 [英] Google Maps Web API - KML IconStyle color doesn't work

查看:315
本文介绍了谷歌地图网页API - KML IconStyle颜色不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有KML和谷歌地图网页API的一个问题。
如果我用颜色标记为IconStyle标记在地图上的标记不显示。
这是在地图上显示如果我删除颜色标记。
我敢肯定,在KML工作正常,直到2-3个月前。

这是我的KML文件:

 < XML版本='1.0'编码='UTF-8'&GT?;
< KML的xmlns =HTTP://www.opengis.net/kml/2.2'>
    <文件>
        <名称>地图< /名称>
        <描述><![CDATA []]>< /描述>
        <&夹GT;
            <名称>地图< /名称>
            <标>
                < styleUrl>#图标961-62AF44< / styleUrl>
                <名称>唧唧歪歪< /名称>
                <描述><![CDATA [描述唧唧歪歪]>< /描述>
                <点和GT;
                    <&坐标GT; 12.429284000000052,41.899191,0.0< /坐标>
                < /点和GT;
            < /标>
    < /文件夹>
    <风格ID ='图标961-62AF44'>
        < IconStyle>
            <彩色> ff44AF62< /彩色>
            <项目建设规模及GT; 1.1< /规模与GT;
            <图标和GT;
                &LT; HREF&GT; HTTP://www.gstatic.com/mapspro/images/stock/961-wht-square-blank.png< / HREF&GT;
            &LT; /图标&GT;
        &LT; / IconStyle&GT;
    &LT; /样式和GT;
    &LT; /文件&GT;
&LT; / KML&GT;

这是我的javascript:

 &LT;脚本&GT;
      VAR地图;      函数初始化(){
         VAR的MapOptions = {
           中心:新google.maps.LatLng(41.7,12.6)
           变焦:9
         };
         地图=新google.maps.Map(的document.getElementById(图)的MapOptions);
         VAR ctaLayer =新google.maps.KmlLayer('http://test.com/test.kml',{preserveViewport:真});
         ctaLayer.setMap(地图);
      }      google.maps.event.addDomListener(窗口'负荷',初始化);
   &LT; / SCRIPT&GT;

一些建议?
谢谢你。


解决方案

这是在谷歌地图JavaScript API V3的一个问题。

8551:错误:KmlLayer-地标用颜色来FFFFFFFF不同将不会显示


  

什么步骤将重现该问题?


  
  

      
  1. 用点创建KML和带颜色值FFFFFFFF不同应用的IconStyle

  2.   
  3. 使用KML创建KmlLayer

  4.   

  
  

据KmlLayers彩色文档不支持在所有的IconStyle,应该被忽略(因此应该不会影响以任何方式层)。


  
  

当然,这将有可能简单地删除的颜色​​,但是当你使用KML从其他应用程序导出,这并不总是一个选项。


  
  

特别是我的意思是我的地图,它是不可能的,当你想使用一个KmlLayer导出KML用符号(除白色符号)


  
  

相关SO-问题:谷歌地图API的JavaScript不会显示标记的KML从我的地图



  

感谢您报告它。我们已经在内部提起它,将相应的优先级。


  
  

状态:接受


  
  

标签:内部-24115271


I have a problem with KML and Google Maps Web API. If I use color tag into IconStyle tag the markers doesn't shows on maps. It's shows on map if I remove color tag. I'm sure that the KML worked correctly until 2-3 months ago.

This is my KML file:

<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
    <Document>
        <name>MAP</name>
        <description><![CDATA[]]></description>
        <Folder>
            <name>MAP</name>
            <Placemark>
                <styleUrl>#icon-961-62AF44</styleUrl>
                <name>BLA BLA BLA</name>
                <description><![CDATA[DESCRIPTION BLA BLA BLA]]></description>
                <Point>
                    <coordinates>12.429284000000052,41.899191,0.0</coordinates>
                </Point>
            </Placemark>
    </Folder>
    <Style id='icon-961-62AF44'>
        <IconStyle>
            <color>ff44AF62</color>
            <scale>1.1</scale>
            <Icon>
                <href>http://www.gstatic.com/mapspro/images/stock/961-wht-square-blank.png</href>
            </Icon>
        </IconStyle>
    </Style>
    </Document>
</kml>

This is my javascript:

   <script>
      var map;

      function initialize() {
         var mapOptions = {
           center: new google.maps.LatLng(41.7,12.6),
           zoom: 9
         };
         map = new google.maps.Map(document.getElementById("map"), mapOptions);
         var ctaLayer = new google.maps.KmlLayer('http://test.com/test.kml', {preserveViewport: true});
         ctaLayer.setMap(map);
      }

      google.maps.event.addDomListener(window, 'load', initialize);
   </script>

Some advise? Thank you.

解决方案

This is an issue in the Google Maps Javascript API v3.

8551: Bug: KmlLayer-Placemarks with color different to ffFFFFFF will not be displayed

What steps will reproduce the problem?

  1. Create a KML with a Point and apply an IconStyle with a color-value different to ffFFFFFF
  2. use the KML to create a KmlLayer

According to the documentation in KmlLayers color isn't supported at all for IconStyle and should be ignored(and therefore shouldn't affect the Layer in any manner).

Of course it would be possible to simply remove the color, but when you use KML exported from other applications this is not always an option.

Especially I mean My Maps, where it's not possible to use Symbols(except white symbols) when you want to use the exported KML in a KmlLayer

related SO-question: Google Maps JavaScript API won't display markers from KML exported from My Maps


Thanks for reporting it. We've filed it internally and will prioritize accordingly.

Status: Accepted

Labels: Internal-24115271

这篇关于谷歌地图网页API - KML IconStyle颜色不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆