Yes, I'm working on just that. Get the new position for your marker, create a new OpenLayers.LonLat for it. var newLonLat = new OpenLayers.LonLat(nextPos.lon, nextPos.lat);
Get the Px position for that point on your map: var newPx = g_map.getLayerPxFromLonLat(newLonLat); myMarker.moveTo(newPx); --Mike On Jun 9, 2009, at 3:33 AM, Juuso Räsänen wrote: > > Hello all, > > I would like to create a map with dynamically moving markers (or > features). So something like this... > http://transport.wspgroup.fi/hklkartta/ > > ... > but much simpler (at least in the beginning) and, of course, utilizing > OpenLayers insted of GMaps. Well, Have you seen ANYTHING similar > implemented with OpenLayers? Any, even very simple, examples? For me > it > seems that OpenLayers doesn't provide any (higher level) APIs for > doing things like that.. Correct? > > I did some proof-of-concept > tests by periodically calling the following function. It works :), but > of course there is a lot of coding todo.. :| > > // A function for moving marker to specified lonlat location. > > // OpenLayers seems to provide only pixel-based moveTo - method... > > function setLonLat(marker, lonlat) { > > if (lonlat != null) { > > marker.lonlat = lonlat; > > if (marker.map != null) { > > var px = marker.map.getLayerPxFromLonLat(marker.lonlat); > > if (px != null) { > > marker.draw(px); > > } > > } > > } > > } > > > BR, > - Juuso _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
