[OpenLayers-Users] Moving a OpenLayers.Feature.Vector: How?

darethehair darethehair at gmail.com
Mon Sep 24 05:59:35 PDT 2012


I would like to move (rather than destroy and rebuild) a
'OpenLayers.Feature.Vector' by simply changing its lat/long, but the 'move'
makes the feature disappear.  Do I have to refresh/redraw something to
finish the task?  Here is the basic code that I have now:

...
geo_point_vectors = new OpenLayers.Layer.Vector('Geo Point');
geo = new OpenLayers.LonLat(geo_long, geo_lat).transform(epsg4326,
epsg900913);
geo_point = new OpenLayers.Geometry.Point(geo.lon, geo.lat); 
geo_pointFeature = new OpenLayers.Feature.Vector(geo_point, {title: "GEO"},
{
        fillColor : "Yellow",
        fillOpacity : 1.0,
        strokeColor : "Orange",
        strokeOpacity : 1,
        strokeWidth : 1,
        pointRadius : 5
});     
geo_point_vectors.addFeatures([geo_pointFeature]);
map.addLayers([geo_point_vectors]);
...
geo = new OpenLayers.LonLat(new_geo_long, new_geo_lat).transform(epsg4326,
epsg900913);
geo_pointFeature.move(geo.lon, geo.lat); 
...

I would think that lots of folks have already written similar code e.g. for
tracking a moving car GPS position, but I found it very difficult to find
any examples out there (!).

P.S. I was going to wrap my code in 'raw' markers for this post, but the
last time I tried it the text was invisible to everyone -- so I left it as
plain text..  Did I do something wrong?



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Moving-a-OpenLayers-Feature-Vector-How-tp5004007.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list