0

我正在根据 geocodezip 提供的一些示例来实现 geoxml3。实现此功能后,似乎没有渲染多边形对象,而仅渲染了 KML 中的多多边形。

从文档看来,需要做的就是使用geoxml3的构造函数;

geoXml = new geoXML3.parser({
                    map: map,
                    infoWindow: infowindow,
                    singleInfoWindow: true,
                    processStyles: true,
                    zoom: geoZoom,
                    markerOptions: {optimized: false},
                    afterParse: useTheData
                });
                geoXml.parse('http://serviceintelligencemap.dev.servicebench.com/MicroStrategy/plugins/GoogleMapViz/WEB-INF/xml/statesLayer6A2E05DB4BD8279D3EA05EBD921AF41223.kml');
            };

它从这里读取整个 xml 并对其进行解析。

下面是“工作”示例。它应该呈现所有状态,但它只呈现多面体;

http://serviceintelligencemap.dev.servicebench.com/MicroStrategy/plugins/GoogleMapViz/WEB-INF/xml/tst.html

4

1 回答 1

0

您的KML 无效。您在坐标之间缺少空格。

  • KML 验证器 (feedvalidator.org)
  • KML 验证器 (feedvalidator.org)

    <Polygon><outerBoundaryIs><LinearRing><coordinates>-114.63332,34.87057,0.0-114.63305,34.86997,0.0-114.56953,34.79181,0.0-114.48236,34.71453,0.0-114.44166,34.64288,0.0-114.38169,34.47903,0.0-114.29195,34.41527,0.0-114.14737,34.31087,0.0-114.26017,34.17212,0.0-114.35765,34.12866,0.0-114.4355,34.04257,0.0-114.49813,33.96372,0.0-114.51318,33.91285,0.0-114.52801,33.84446,0.0-114.49649,33.6969,0.0-114.5402,33.58709,0.0-114.61185,33.47131,0.0-114.72123,33.39691,0.0-114.68157,33.23376,0.0-114.62973,33.03255,0.0-114.48131,32.97206,0.0-114.46563,32.87408,0.0-114.58576,32.73487,0.0-114.63501,32.73137,0.0-114.69096,32.73946,0.0-114.71919,32.71943,0.0-114.71972,32.71875,0.0-114.9559,32.70253,0.0-115.47927,32.66605,0.0-115.50314,32.66438,0.0-115.80199,32.64163,0.0-116.0738,32.6211,0.0-116.19899,32.61112,0.0-116.3481,32.59913,0.0-116.46732,32.58952,0.0-116.61646,32.57725,0.0-116.75596,32.56578,0.0-116.82902,32.55977,0.0-116.95778,32.54863,0.0-117.02945,32.54234,0.0-117.06674,32.5395,0.0-117.22314,32.6209,0.0-117.30735,32.65404,0.0-117.34004,32.83452,0.0-117.37526,33.07321,0.0-117.57153,33.3123,0.0-117.71501,33.40862,0.0-117.81636,33.49087,0.0-117.94957,33.55979,0.0-118.06299,33.63031,0.0-118.34541,33.66343,0.0-118.51367,33.93905,0.0-118.62007,33.98697,0.0-118.74596,33.97556,0.0-118.87592,33.98382,0.0-119.22693,34.07434,0.0-119.33489,34.23687,0.0-119.56331,34.34814,0.0-119.73923,34.34275,0.0-119.90542,34.36437,0.0-120.12095,34.41671,0.0-120.24944,34.41798,0.0-120.42603,34.39674,0.0-120.56388,34.4893,0.0-120.6724,34.51999,0.0-120.70856,34.60609,0.0-120.683,34.7177,0.0-120.68251,34.80895,0.0-120.73438,34.9015,0.0-120.6942,35.03457,0.0-120.78292,35.11198,0.0-120.96025,35.24362,0.0-120.93094,35.37806,0.0-121.05951,35.4377,0.0-121.25103,35.60068,0.0-121.4561,35.81771,0.0-121.7489,36.14645,0.0-121.86514,36.20183,0.0-121.92971,36.25918,0.0-121.96481,36.32734,0.0-121.97196,36.37682,0.0-121.98576,36.42509,0.0-122.022,36.50891,0.0-122.04406,36.58872,0.0-122.06832,36.87495,0.0-122.27637,37.02483,0.0-122.4452,37.14967,0.0-122.47161,37.31479,0.0-122.56299,37.47338,0.0-122.57267,37.62752,0.0-122.63247,37.82781,0.0-122.78903,37.89376,0.0-122.89742,37.97575,0.0-123.08461,37.98809,0.0-123.12347,38.28431,0.0-123.18504,38.40068,0.0-123.3304,38.49991,0.0-123.49508,38.66066,0.0-123.7253,38.84412,0.0-123.76207,39.03837,0.0-123.80553,39.1249,0.0-123.84839,39.21873,0.0-123.89494,39.34835,0.0-123.88889,39.44394,0.0-123.83841,39.55492,0.0-123.87391,39.68453,0.0-123.9536,39.82699,0.0-124.06357,39.95662,0.0-124.2312,40.09338,0.0-124.42868,40.27564,0.0-124.47916,40.45264,0.0-124.33411,40.71898,0.0-124.1945,40.9617,0.0-124.2151,41.03142,0.0-124.24743,41.09222,0.0-124.25119,41.13756,0.0-124.21142,41.18092,0.0-124.17435,41.25705,0.0-124.19233,41.29199,0.0-124.23454,41.31575,0.0-124.23517,41.36383,0.0-124.14406,41.38412,0.0-124.15357,41.51075,0.0-124.22986,41.6897,0.0-124.41076,41.78831,0.0-124.31194,41.85879,0.0-124.32829,41.99807,0.0-124.32883,41.99833,0.0-124.11879,41.99703,0.0-123.96782,41.99625,0.0-123.79381,41.99569,0.0-123.62007,41.99984,0.0-123.51413,42.00086,0.0-123.2737,42.00197,0.0-123.03178,42.00302,0.0-122.78389,42.00388,0.0-122.64619,42.00482,0.0-122.40756,42.00869,0.0-122.18647,42.00755,0.0-122.00032,42.00397,0.0-121.81573,42.00262,0.0-121.70538,42.00077,0.0-121.6122,41.99933,0.0-121.51946,41.99827,0.0-121.43715,41.99738,0.0-121.36025,41.99668,0.0-121.26065,41.99759,0.0-120.97395,41.99336,0.0-120.76508,41.99387,0.0-120.60306,41.99309,0.0-120.30731,41.99313,0.0-120.19996,41.99443,0.0-120.00104,41.99514,0.0-119.99917,41.99454,0.0-119.99919,41.97905,0.0-120.00002,41.26742,0.0-119.99926,40.86934,0.0-119.99567,40.39719,0.0-119.99733,40.08934,0.0-120.00049,39.79567,0.0-120.0015,39.57782,0.0-120.00608,39.37557,0.0-119.9748,38.98156,0.0-119.76041,38.83427,0.0-119.43506,38.60904,0.0-119.00097,38.30368,0.0-118.51722,37.96065,0.0-118.22972,37.75309,0.0-118.04392,37.6185,0.0-117.79563,37.43715,0.0-117.31883,37.08441,0.0-116.87227,36.75057,0.0-116.37528,36.37205,0.0-116.08072,36.14577,0.0-115.89512,36.0018,0.0-115.65233,35.81231,0.0-115.36992,35.59033,0.0-115.11622,35.38796,0.0-114.82052,35.15341,0.0-114.63361,35.00195,0.0-114.63349,35.00186,0.0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
    
于 2013-12-18T18:32:18.377 回答