use*_*590 6 javascript google-maps google-maps-api-3
(请原谅我的英语不好)我的多边形的顶部存储在我的数据库中(纬度,经度).所以我在一张桌子上恢复了纬度和经度,然后画了我的多边形.我的问题是,3个顶部它工作正常,但当它超过3时,它给出了这个结果:

这是我的代码:
success: function(data) {
// alert(data);
var tableauPointsPolygone = new Array ();
var j=0;
var somme=0;
$.each(data, function(i, item) {
tableauPointsPolygone.push(new google.maps.LatLng(item.latitude, item.longitude));
somme+= parseInt(item.valeur);
j++;
addMarker(item.latitude,item.longitude,item.adr);
center = bounds.getCenter();
map.fitBounds(bounds);
// alert(item.latitude);
});
var monPolygone = new google.maps.Polygon();
monPolygone.setPaths( tableauPointsPolygone );
monPolygone.setMap( map );
if (somme/j<5)
monPolygone.setOptions({strokeWeight: 3,strokeColor: '#582900' ,fillColor: '#1FA055'});
else
monPolygone.setOptions({strokeWeight: 3,strokeColor: '#582900' ,fillColor: '#A91101'});
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
268 次 |
| 最近记录: |