我一直在玩带有“孔”的多边形(以匹配重叠的多边形等)。我已经找到了一种获取带有多边形的geojson的方法,但是在MapBox上显示时,它显示的很奇怪。
geojson是
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[[151.05429768562317,-33.78511304323038],[151.05528473854065,-33.78528246694794],[151.05666875839233,-33.78567481532272],[151.0588788986206,-33.78800211758811],[151.05849266052246,-33.78807345152433],[151.0584819316864,-33.78815370213156],[151.05907201766968,-33.788305286406654],[151.05777382850647,-33.789089953658376],[151.0582673549652,-33.79023127500619],[151.0588252544403,-33.79004402801582],[151.0597264766693,-33.79051660296599],[151.05996251106262,-33.79131908275495],[151.06037020683289,-33.79122991870538],[151.06041312217712,-33.79134583195171],[151.06042385101318,-33.79123883511453],[151.06062769889832,-33.79125666793],[151.0606062412262,-33.79148849419329],[151.06184005737305,-33.79118533664579],[151.0617220401764,-33.79086434513135],[151.06209754943848,-33.79077518060821],[151.0622262954712,-33.79104267389906],[151.0627841949463,-33.790908927358096],[151.06284856796265,-33.79106942318218],[151.06310606002808,-33.79082867933323],[151.0632026195526,-33.790953509561625],[151.06313824653625,-33.79111400530214],[151.0635781288147,-33.791015924607585],[151.0637390613556,-33.79066818305786],[151.06407165527344,-33.7908108464286],[151.06430768966675,-33.79081976288139],[151.06526255607605,-33.790650350119805],[151.0658311843872,-33.79086434513135],[151.06773018836975,-33.79036502260574],[151.06961846351624,-33.79552752026243],[151.0666573047638,-33.79632103720271],[151.06380343437195,-33.7968381566431],[151.05912566184998,-33.79791696472892],[151.0556924343109,-33.79932563580985],[151.0540509223938,-33.79930780467522],[151.05225920677185,-33.79908491517893],[151.04966282844543,-33.79846973715739],[151.04960918426514,-33.79757816695989],[151.04984521865845,-33.797239367849826],[151.05311751365662,-33.79650827046432],[151.05262398719788,-33.79522437701759],[151.05264544487,-33.794323856929815],[151.0523772239685,-33.79354815381428],[151.05172276496887,-33.792941852232396],[151.05082154273987,-33.79251387205992],[151.0492980480194,-33.79120316947242],[151.04869723320007,-33.790400688596996],[151.04853630065918,-33.789366368818406],[151.04905128479004,-33.78868870425759],[151.05020999908447,-33.787734614797984],[151.05095028877258,-33.787422527153275],[151.05127215385437,-33.7869677688347],[151.05193734169006,-33.786905350837785],[151.05273127555847,-33.78519329661205],[151.05328917503357,-33.785300301003964],[151.05429768562317,-33.78511304323038]],
[[151.0646939277649,-33.796677671633844],[151.0666573047638,-33.79632103720271],[151.06961846351624,-33.79552752026243],[151.06773018836975,-33.79036502260574],[151.0658311843872,-33.79086434513135],[151.06526255607605,-33.790650350119805],[151.06460809707642,-33.790757347692434],[151.0646939277649,-33.796677671633844]]
]
}
}
这是Leaflet的示例-正确显示-http://jsfiddle.net/prasmo/ev4q9kgd/8/。
这是Mapbox的示例-无法正确显示-https://jsfiddle.net/prasmo/n4uy18ws/3/。
关于Mapbox为什么不像Leaflet那样显示多边形的任何想法吗?我对它为什么如此表现完全迷失了。
答案 0 :(得分:0)
根据geojsonlint.com,您的geojson无效:
第4行:多边形和多多边形应遵循右手规则