谷歌地图v3:多个KML图层的Z-Index问题

时间:2012-10-23 14:53:58

标签: google-maps google-maps-api-3 google-maps-markers

我有一张带有4个单独叠加层的Google地图(v3)地图,这些叠加层由4个单独的KML文件填充。其中三个KML文件仅指示地图上的点,我将其渲染为不同颜色(例如红色,蓝色,黄色)Google制造商。第三个叠加层包含多个多边形坐标(即建筑轮廓)。

问题是多边形(建筑物轮廓)位于其他3个叠加层中的标记之上。我希望其他三个叠加(标记)位于多边形之上。

3 个答案:

答案 0 :(得分:3)

这个帖子是谷歌搜索返回的,所以请注意谷歌地图为kml叠加添加了zIndex规范,现在应该是“答案”

答案 1 :(得分:1)

首先将多边形的KmlLayer添加到地图中(您可能需要等待渲染它以确保它位于底部)。有几个feature requests to allow specifying the relative z-index of layers,但尚未实施。

答案 2 :(得分:-1)

hHere是一个简单的修复:在文件夹中放置特定于其分层需求的元素,为每个文件夹提供一个TimeSpan - End,其中需要最明显的图层的末端比其他图层的值更大。 此示例始终将sandtraps和tees定位在孔多边形上方。

<Folder id="placemarks">
<TimeSpan><end>Wed Dec 31 15:59:59 PST 2012</end></TimeSpan>
<Placemark id="Hole_1"><name>Hole #1</name><styleUrl>#Hole</styleUrl><Polygon><outerBoundaryIs><LinearRing><coordinates>-122.91870161890983,45.483615855274756,0 -122.91865199804306,45.48361585527471,0 -122.91855275630951,45.483619616338856,0 -122.91794121265411,45.48370235968636,0 -122.91695952415466,45.483627138466375,0 -122.91472256183624,45.483218121324924,0 -122.91451670229435,45.483212949824846,0 -122.9143376648426,45.48322470323348,0 -122.91415393352508,45.48328488064735,0 -122.91402518749237,45.483354460702024,0 -122.91395008563995,45.48342404067077,0 -122.91389912366867,45.48350772457338,0 -122.91387498378753,45.48359328888462,0 -122.91387498378753,45.48368543492061,0 -122.91389375925064,45.48373808973069,0 -122.91392594575882,45.48377617041085,0 -122.91397422552109,45.48379920685918,0 -122.91409760713577,45.483826474479734,0 -122.91429609060287,45.48382083290416,0 -122.91442953050136,45.48381519132801,0 -122.91455760598182,45.48383399657965,0 -122.91581690311432,45.484202578244506,0 -122.91596710681915,45.48423454694876,0 -122.91628360748291,45.48424018848292,0 -122.91661083698272,45.48421950285486,0 -122.9167677462101,45.484191765296345,0 -122.91696421802044,45.484127122628124,0 -122.9171821475029,45.48403615263833,0 -122.9174154996872,45.48397879680701,0 -122.91756838560104,45.483983498106866,0 -122.91772797703743,45.48396140199421,0 -122.91793651878834,45.48391838506911,0 -122.91816920042038,45.483914859090184,0 -122.91850447654724,45.48388665125083,0 -122.91868150234222,45.48381895237883,0 -122.91873782873153,45.483689195980105,0 -122.91874051094055,45.483630899529764,0 -122.91870161890983,45.483615855274756,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
</Folder>
<Folder id="placemarks2">
<TimeSpan><end>Thu Mar 14 15:24:23 PDT 2013</end></TimeSpan>
<Placemark id="Overlay_104"><name>Sand</name><styleUrl>#Sand</styleUrl><Polygon><drawOrder>2</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91651293635368,45.484182832859304,0 -122.91652634739876,45.48417060952213,0 -122.91653171181679,45.48415368489706,0 -122.91653037071228,45.484138640781616,0 -122.91652366518974,45.48412359666217,0 -122.91650488972664,45.48411325382773,0 -122.916479408741,45.484101030475465,0 -122.91644051671028,45.484088807120536,0 -122.91640967130661,45.48408504608773,0 -122.91637346148491,45.48408128505467,0 -122.91634932160377,45.48408410582948,0 -122.91632384061813,45.484093508411206,0 -122.91630908846855,45.48411043305436,0 -122.91630372405052,45.484120775889316,0 -122.91630372405052,45.4841329992373,0 -122.91630908846855,45.48414522258262,0 -122.91632384061813,45.48415650566826,0 -122.91634261608124,45.48416308746718,0 -122.91636407375335,45.48416308746718,0 -122.91638284921646,45.48415932643931,0 -122.9164083302021,45.48415368489706,0 -122.91641905903816,45.48415838618231,0 -122.91641905903816,45.484166848494766,0 -122.91641235351562,45.4841771913194,0 -122.91642308235168,45.484184713372464,0 -122.91644051671028,45.484190354911604,0 -122.91645929217338,45.48419411593739,0 -122.9164807498455,45.48419411593739,0 -122.91650220751762,45.48418753414211,0 -122.91651293635368,45.484182832859304,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Overlay_105"><name>Sand</name><styleUrl>#Sand</styleUrl><Polygon><drawOrder>2</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91556611657142,45.48406247988558,0 -122.91557282209396,45.48407000195396,0 -122.91557148098945,45.48407940453805,0 -122.9155795276165,45.48409068763687,0 -122.91560500860214,45.484096329185405,0 -122.91562780737877,45.484095388927365,0 -122.91565462946892,45.48408786686237,0 -122.91567474603653,45.484074703246186,0 -122.91568011045456,45.48406153962695,0 -122.91568413376808,45.48404743574578,0 -122.91567742824554,45.484032391601964,0 -122.91566535830498,45.48401922797283,0 -122.91564390063286,45.48400982537872,0 -122.91560903191566,45.48400888511922,0 -122.915578186512,45.48400982537872,0 -122.91555404663086,45.484003243561915,0 -122.91551917791366,45.48399290070535,0 -122.91550442576408,45.48399384096513,0 -122.91547894477844,45.48400230330229,0 -122.9154534637928,45.48401734745415,0 -122.91544675827026,45.484030511083716,0 -122.9154534637928,45.4840511967811,0 -122.9154722392559,45.48406624091988,0 -122.91550174355507,45.48407658376298,0 -122.91552051901817,45.48407658376298,0 -122.91553929448128,45.48407094221243,0 -122.91555672883987,45.48406153962695,0 -122.91556611657142,45.48406247988558,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Overlay_106"><name>Sand</name><styleUrl>#Sand</styleUrl><Polygon><drawOrder>2</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91515573859215,45.48395717082267,0 -122.91517853736877,45.4839496487392,0 -122.9152013361454,45.48393742535144,0 -122.91521206498146,45.48392332143921,0 -122.91521072387695,45.48391109804572,0 -122.91520535945892,45.4838969941269,0 -122.91519463062286,45.483881949942905,0 -122.91516780853271,45.483872547325866,0 -122.91514366865158,45.483870666802275,0 -122.91511550545692,45.483875368111136,0 -122.91509807109833,45.483881949942905,0 -122.91507795453071,45.4838960538655,0 -122.91506186127662,45.483912038306876,0 -122.91506722569465,45.48392802274367,0 -122.91509538888931,45.483946827957645,0 -122.91512355208397,45.48395623056229,0 -122.91515573859215,45.48395717082267,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Overlay_107"><name>Sand</name><styleUrl>#Sand</styleUrl><Polygon><drawOrder>2</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91511282324791,45.483822713429426,0 -122.91509941220283,45.48381425106526,0 -122.9150739312172,45.483806728962705,0 -122.91505247354507,45.4837963860701,0 -122.91503503918648,45.48377946133259,0 -122.91501894593239,45.48375877553543,0 -122.91499882936477,45.48373714946662,0 -122.91497468948364,45.483731507882105,0 -122.91494384407997,45.48373338841033,0 -122.91491568088531,45.48374091052268,0 -122.91489824652672,45.48375501448059,0 -122.91489154100418,45.483775700279146,0 -122.91490226984024,45.48379450554396,0 -122.91491836309433,45.48380014712216,0 -122.91493713855743,45.483809549751285,0 -122.91493982076645,45.483824593954615,0 -122.91492909193039,45.4838499810386,0 -122.91494384407997,45.483870666802275,0 -122.91497200727463,45.48388759151238,0 -122.91500151157379,45.4838969941269,0 -122.91501760482788,45.4838960538655,0 -122.9150390625,45.483891352558366,0 -122.91507259011268,45.48387724863458,0 -122.9151101410389,45.48385656287332,0 -122.91511952877044,45.48383399657965,0 -122.91511282324791,45.483822713429426,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Overlay_108"><name>Sand</name><styleUrl>#Sand</styleUrl><Polygon><drawOrder>2</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91608780622482,45.483770058698454,0 -122.91611328721046,45.4837615963264,0 -122.91614949703216,45.48374561184236,0 -122.91618973016739,45.48374185078665,0 -122.9162085056305,45.48373432867442,0 -122.91622459888458,45.483714583125106,0 -122.9162286221981,45.48369389730411,0 -122.91621789336204,45.48367697253584,0 -122.91619643568992,45.48365816723179,0 -122.91616827249527,45.483648764577396,0 -122.9161387681961,45.48364500351523,0 -122.91610389947891,45.48364688404635,0 -122.91608646512031,45.48365628670105,0 -122.9160650074482,45.48367509200573,0 -122.91604354977608,45.48368355439079,0 -122.91601940989494,45.48367885306589,0 -122.91600063443184,45.48367039068013,0 -122.9159563779831,45.483652525639336,0 -122.9159215092659,45.483652525639336,0 -122.91589468717575,45.4836609880278,0 -122.91586250066757,45.48367885306589,0 -122.91585445404053,45.483710822067316,0 -122.91586384177208,45.48373244814623,0 -122.91588395833969,45.483744671578464,0 -122.91590943932533,45.48375125342547,0 -122.91592553257942,45.48375125342547,0 -122.91594296693802,45.4837559547443,0 -122.91598856449127,45.48377193922543,0 -122.91602477431297,45.483778521069254,0 -122.9160650074482,45.48377664054253,0 -122.91608780622482,45.483770058698454,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Overlay_110"><name>Sand</name><styleUrl>#Sand</styleUrl><Polygon><drawOrder>2</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91436985135078,45.48374185078668,0 -122.91438594460487,45.48373714946664,0 -122.91439533233642,45.48373432867442,0 -122.91441276669502,45.48372774682543,0 -122.9144261777401,45.48371364286071,0 -122.91443556547165,45.48369107650978,0 -122.91443020105362,45.48366568935417,0 -122.91441544890404,45.483644063249635,0 -122.91439935564995,45.483636541124355,0 -122.91436985135078,45.4836346605929,0 -122.91434168815613,45.483637481390076,0 -122.91432425379753,45.483648764577396,0 -122.91431620717048,45.483661928293095,0 -122.91432425379753,45.4836685101498,0 -122.9143363237381,45.483681673860886,0 -122.91432693600654,45.483689195980105,0 -122.91431084275245,45.4836844946557,0 -122.91430547833442,45.483674151740644,0 -122.91429877281189,45.48366380882366,0 -122.91427329182625,45.48366286855839,0 -122.91424110531807,45.4836713309453,0 -122.9142290353775,45.48367885306589,0 -122.91423439979553,45.48369295703935,0 -122.91423708200455,45.48370047915707,0 -122.9142290353775,45.48370706100927,0 -122.91421428322792,45.48370047915707,0 -122.91421696543693,45.48368825571527,0 -122.91421562433243,45.48367791280088,0 -122.91419014334678,45.48366004776248,0 -122.91413381695747,45.483641242452784,0 -122.91410431265831,45.483639361921455,0 -122.91409224271774,45.48364594378078,0 -122.91407749056816,45.48366474908892,0 -122.91407480835914,45.48368731545038,0 -122.9140841960907,45.48370706100927,0 -122.91413515806198,45.48374185078665,0 -122.91417136788368,45.48375501448059,0 -122.91420891880989,45.483759715799096,0 -122.91424512863159,45.483759715799096,0 -122.91430950164795,45.48374937289783,0 -122.91435107588768,45.483744671578464,0 -122.91436985135078,45.48374185078668,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Overlay_111"><name>Sand</name><styleUrl>#Sand</styleUrl><Polygon><drawOrder>2</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91445970535278,45.4834484876664,0 -122.91447043418884,45.48344002524603,0 -122.91448518633842,45.483429682286065,0 -122.9144985973835,45.483434383631746,0 -122.91450664401054,45.48344284605295,0 -122.91448786854744,45.483453189010504,0 -122.91446641087532,45.483468233309,0 -122.91446641087532,45.483485158139985,0 -122.91448518633842,45.48351148564473,0 -122.91453346610069,45.48353029099776,0 -122.91456162929535,45.48352935073025,0 -122.91460454463959,45.48352088832202,0 -122.9146420955658,45.483501142697925,0 -122.9146608710289,45.483471994382974,0 -122.9146608710289,45.48345600981676,0 -122.91465014219284,45.483441905784,0 -122.9146260023117,45.48342498094003,0 -122.9145884513855,45.48340711582141,0 -122.9145535826683,45.48338078826786,0 -122.91452139616012,45.483359162053965,0 -122.9144798219204,45.48334317745575,0 -122.91443422436714,45.48333847610246,0 -122.91440606117248,45.48334693853809,0 -122.91437655687332,45.483366684216264,0 -122.91436582803726,45.48338925069713,0 -122.91436985135078,45.48340523528229,0 -122.91438460350036,45.48342027959356,0 -122.91440740227699,45.48343908497702,0 -122.91442885994911,45.483447547397546,0 -122.91444763541221,45.483453189010504,0 -122.91445970535278,45.4834484876664,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Tee_Gold_1"><name>Gold Tee #1</name><styleUrl>#T_Gold</styleUrl><Polygon><drawOrder>3</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91861981153488,45.48369671809834,0 -122.9185326397419,45.48369389730411,0 -122.91852459311485,45.48377758080589,0 -122.91861176490783,45.483781341859235,0 -122.91861981153488,45.48369671809834,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Tee_Blue_1"><name>Blue Tee #1</name><styleUrl>#T_Blue</styleUrl><Polygon><drawOrder>3</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91848301887512,45.48376723790791,0 -122.9182630777359,45.48376347685363,0 -122.91826039552688,45.48383399657965,0 -122.91848167777061,45.48383681736685,0 -122.91848301887512,45.48376723790791,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Tee_White_1"><name>White Tee #1</name><styleUrl>#T_White</styleUrl><Polygon><drawOrder>3</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91820138692856,45.48381237053972,0 -122.91803240776062,45.483807669225584,0 -122.9180297255516,45.483889472035386,0 -122.91819736361503,45.4838951136041,0 -122.91820138692856,45.48381237053972,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Tee_Red_1"><name>Red Tee #1</name><styleUrl>#T_Red</styleUrl><Polygon><drawOrder>3</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91756972670555,45.48389041229689,0 -122.91743963956833,45.48388383046611,0 -122.9174356162548,45.483943066915344,0 -122.91756302118301,45.4839496487392,0 -122.91756972670555,45.48389041229689,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
<Placemark id="Fairway_1"><name>Fairway #1</name><styleUrl>#Fairway</styleUrl><Polygon><drawOrder>1</drawOrder><outerBoundaryIs><LinearRing><coordinates>-122.91679188609123,45.484095388927365,0 -122.91688308119774,45.48406247988558,0 -122.91699305176735,45.48399196044558,0 -122.91703060269356,45.48395058899968,0 -122.91704803705215,45.48389229281982,0 -122.91703596711159,45.48384621998984,0 -122.91699573397636,45.483819892641506,0 -122.91690856218338,45.48380202764812,0 -122.91676640510559,45.48378604317555,0 -122.91657462716102,45.483762536590014,0 -122.91647002100944,45.48374091052268,0 -122.91637882590294,45.48372586629701,0 -122.91633322834968,45.48372868708961,0 -122.91628360748291,45.48373902999469,0 -122.91620045900345,45.48376817817145,0 -122.91611194610595,45.48379262501775,0 -122.91604489088058,45.483802967911075,0 -122.91599795222282,45.48379826659618,0 -122.91580483317375,45.48375689500802,0 -122.91560634970665,45.48369953889241,0 -122.91538909077644,45.48362525793459,0 -122.91519597172737,45.48355003661168,0 -122.91507124900818,45.48350396350177,0 -122.91493311524391,45.483455069548036,0 -122.91485130786896,45.483441905784,0 -122.91478425264358,45.48344566685975,0 -122.91473060846329,45.48346823330902,0 -122.91463941335678,45.48352276885732,0 -122.91458979249,45.4836073928795,0 -122.91453614830971,45.48369483756887,0 -122.91458979249,45.483723045504256,0 -122.91463807225227,45.483744671578464,0 -122.91468098759651,45.48375031316168,0 -122.91472658514976,45.48374937289783,0 -122.91488617658615,45.48370894153833,0 -122.91493579745292,45.48370047915707,0 -122.91498005390167,45.48370706100927,0 -122.9150202870369,45.48372492603276,0 -122.91515305638313,45.483821773166774,0 -122.9152549803257,45.48390357595612,0 -122.91532203555107,45.48393648509073,0 -122.91538774967193,45.483960931864004,0 -122.91544407606125,45.48396751368577,0 -122.91560500860214,45.48397973706699,0 -122.91568279266357,45.4839957214846,0 -122.91588798165321,45.48404837600464,0 -122.91600063443184,45.48406342014418,0 -122.91615217924118,45.48407000195396,0 -122.91626617312431,45.48405777859231,0 -122.91635200381279,45.484049316263466,0 -122.91639894247055,45.48405307729866,0 -122.91657865047455,45.484099149959484,0 -122.91666179895401,45.48411325382773,0 -122.91679188609123,45.484095388927365,0</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark>
</folder>