I am working on a mapping project that allows the user to draw polylines. It all seems to work when the user clicks points of the polyline. From there I save the gps coords to a database. When I then retrieve the coordinates and display the polyline it does crazy things. It initially displays correctly but when zooming in, the line sometimes disappears, or draws in incorrect locations. If it does draw in incorrect locations and you pan, the polyline constantly moves.
Can anyone please help, this problem is starting to drive me crazy.
I have included "some" of my code.
function
loadMap(){
mapDiv = document.getElementById("myMap");
new VEMap('myMap');map.LoadMap();
map.HideDashboard();
map.ShowDisambiguationDialog(
false);map.AttachEvent(
'onmouseup', mapMouseUp); //Check to see if the path needs to be reconstructed if(hdnPath.value != "")reloadPath();
if((hdnPath.value != ""))viewByBoundingLocations();
}
function
reloadPath(){
pts =
new Array(); var vals = hdnPath.value.split(','); for(i = 0; i < vals.length; i++){
pts.push(
new VELatLong(vals
i++
}
drawPolyline();
}
function
drawPolyline() {map.DeleteAllPolylines();
if (pts.length > 1){
var poly = new VEPolyline(1,pts);poly.SetWidth(2);
poly.SetColor(
new VEColor(255,0,0,1));map.AddPolyline(poly);
}
}