<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffcc" text="#000000">
I'm attempting to use OpenLayers to display dynamically moving markers.
The data from the markers is actually being read from a dynamically
updating table elsewhere on the page which updates from a webservice
every 10 seconds. I pull actually changed, new or deleted data from the
table and then "manually" create, move or delete markers. Markers are
being created or destroyed correctly, but just not moving.<br>
<br>
I have created a simple example to show that I could actually have the
markers move manually and still be in the right place when zooming and
still have events attached to them.<br>
<a href="http://dealmaker.dyndns.org:8080/move-markers.html">http://dealmaker.dyndns.org:8080/move-markers.html</a><br>
<br>
<big><font size="-1"><big><font face="Verdana">However, I have not had
any luck with the
markers themselves in our project. The OpenLayers functions seem to be
doing everything properly. I have closely followed the code through
each step in the process and also examined both the marker's properties
and its div. The functions are modifying the style definition of
the marker div with the correct coordinates. However, the map display
is not refreshing. When doing DOM inspection, the marker divs are in
their original location with the original left &amp; top position
values. Also the marker divs become permanently pinned to
the window such that they show in the same location at all zoom levels.
However, when zooming in or out, new correctly placed marker divs are
also created. Then, the markers are present at wrong locations &amp;
wrong sizes and correct locations &amp; sizes (until another update is
fired and the marker fails to move).<br>
<br>
here is the marker move code for both the example &amp; the actual
project:<br>
<br>
Actual Project<br>
----------------- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
var mrkr = vehLayer.markers[j];<br>
var newLon = objArray[i].X;<br>
var newLat = objArray[i].Y;<br>
var newLonLat = new OpenLayers.LonLat(newLon,newLat);<br>
var newPx = vehLayer.getViewPortPxFromLonLat(newLonLat);<br>
mrkr.moveTo(newPx); <br>
<br>
Example<br>
-------------------<br>
//randomly move all the markers<br>
for(var i=0;i&lt;markerLayer.markers.length;i++)<br>
{<br>
&nbsp;&nbsp;&nbsp; var mrkr=markerLayer.markers[i];<br>
&nbsp;&nbsp;&nbsp; var sign = Math.random();<br>
&nbsp;&nbsp;&nbsp; (sign&lt;0.5)?sign=(-1):sign=1;<br>
&nbsp;&nbsp;&nbsp; var newLon = sign * Math.random() + mrkr.lonlat.lon;<br>
&nbsp;&nbsp;&nbsp; var newLat = sign * Math.random() + mrkr.lonlat.lat;<br>
&nbsp;&nbsp;&nbsp; var newLonLat = new OpenLayers.LonLat(newLon,newLat);<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp; var newPx = map.getPixelFromLonLat(newLonLat);<br>
&nbsp;&nbsp;&nbsp; mrkr.moveTo(newPx);<br>
} <br>
<br>
Does anyone have any idea what could be wrong with the real project
such that the viewport is not being refreshed except when doing a zoom
in or zoom out?<br>
If there is anymore info I could give to help solve the problem, I'd be
happy to give it.<br>
<br>
</font></big></font></big>
<div class="moz-signature">-- <br>
<b>Matt Priour</b><br>
<a href="http:%5C%5Cwww.kestrelcomputer.com">Kestrel Computer Consulting</a>
<br>
<a href="mailto:mpriour@kestrelcomputer.com"></a></div>
</body>
</html>