javascript - Google maps api kml filling incorrect -
i have simple html , simple kml file ma trying display in google maps. problem filling of single polygon isn't working correctly. if @ example below, can see polygon filled on right side (which correct framing). zoom in 1 level , filling flips other side. zoom in again, , flips back. zooming out once , flips, zoom out twice , correct filling. , remains correct keep zooming out.
i have read elsewhere using geoxml3 parse kml rather having google it. trunk download doesn't support polygons though,s (think) downloaded branch version of it. based on that, appears parsing kml , creating google.maps.polyline objects. problem need display hundreds (of not thousands) of polygons , load time convert kml expect performance limiting. not mention, have google's zoom level simplification of kml files.
any thoughts? has been working couple of years , broke few weeks ago. tested on chromium 37 (linux) firefox 38 (linux), chrome 43 (win7), firefox 37 (win7), , ie11 (win7). other option trying use google.maps.imagemaptype() google.maps.overlaymaptypes() require quite bit of re-enginering?
thanks!
the html page:
<html>
<head>
<style>
#mapcanvas {height: 600px;width: 600px;}
</style>
</head>
<body>
<div id="mapcanvas">
<script src="http://maps.google.com/maps/api/js?v=3.&libraries=geometry,drawing,places&sensor=false"/>
<script>
var googlemap = new google.maps.map(document.getelementbyid('mapcanvas'), {
maxzoom: 20,
minzoom: 4,
zoom: 17,
pancontrol: true,
zoomcontrol: true,
scalecontrol: true,
streetviewcontrol: true,
tilt: 0,
center: new google.maps.latlng(39.77420517, -94.83232857)
});
var kml = new google.maps.kmllayer('http://itic.occinc.com/new5.kml', {
preserveviewport: true,
suppressinfowindows:true,
clickable: false,
map: googlemap
});
</script>
</body>
</html>
and kml (in case disappears of server):
<kml xmlns="http://www.opengis.net/kml/2.2">
<folder>
<name>district polygon folder</name>
<open>1</open>
<description></description>
<placemark>
<name>folder object 2 (polygon)</name>
<polygon>
<altitudemode>clamptoground</altitudemode>
<outerboundaryis>
<linearring>
<coordinates>
-94.84433855, 39.53505883
-94.83010566, 39.82194139
-94.59858395, 39.8204777
-94.59383965, 39.53213146
-94.84433855, 39.53505883
</coordinates>
</linearring>
</outerboundaryis>
</polygon>
</placemark>
</folder>
</kml>
there bug in google kml renderer.
Comments
Post a Comment