Hi Michael (and everyone else who replied), Thanks for your quick replies. I'm working on this some more today and have some follow up questions.
I define my point list in the global scope: var route_points = new Array(); Then I populate this array with a few points. Finally I can build the structures and add the result to a layer so I can see it (and I do see the result.) lineString = new OpenLayers.Geometry.LineString(route_points); route_vector = new OpenLayers.Feature.Vector(lineString,null,home_style); routeLayer.addFeatures( route_vector ); Later I go back and change the location of a point in my route_list array of points. route_points[2].lon = newlon; route_points[2].lat = newlat; But nothing changes on screen. (for what it's worth, I can recreate all these structures and add them as a new layer to my map and I do see the new points in their correct locations, but it's as a new feature along with the old -- I'm hoping to be able to simply modify the old structure rather than having to create a new (potentially large/complex) structure each iteration. I am wondering if the lineString or the Vector constructors use a copy of the upstream structure rather than a pointer to the structure? In that case changing my original structure would have no effect. I wouldn't mind using accessor functions to find the actual data point, but as I look through the class definitions and inheritance, I don't see any way to get back to the original point array when starting from a Vector() or a LineString()? I'm probably missing something stupid or easy, but I'm just not seeing it? Am I on the right track or missing by a mile? Thanks, Curt. On Wed, Apr 11, 2012 at 2:22 PM, Michael <[email protected]> wrote: > Both are doable. You need to do a little digging to be sure you are > pointing to the correct point when you either change its lonlat or delete > it. Then you need to redraw the line. > > In my application, I maintained a separate array pointing to the points in > my line. Possibly not the most efficient, but it worked. > > Michael > > > On 4/11/2012 12:08 PM, Curtis Olson wrote: > > Hi, > > I've begun my plunge into openlayers and have a number of things working, > but I've run into a question that I haven't been able to answer for myself > from the docs and the mailing list archives. > > I am building a map that will live track an object (for example: my > aircraft location as I fly in the FlightGear flight simulator.) > > I would like to leave a trail behind myself showing my recent path (say > for the past 10 seconds or the past 10 minutes.) I am imagining a > LineString where I can insert new points at one end and remove points from > the other end -- as my position updates. > > I could create an entirely new LineString and Vector and add that to my > layer 10x a second (removing the old feature), but I was hoping I could > just build the linestring once, add it too a layer once, and from then on > just modify the linestring structure. > > Is something like this possible or am I barking up the wrong tree? > > I have another sort of similar situation where I may want to > additionally modify the point locations of some of the points in the > linestring (based on external data coming from the flight simulator.) In > otherwords I want to reshape the linestring by adjusting the locations of > individual points. Is anything like this possible? > > I've been hunting through the examples and the documentation and haven't > stumbled on the appropriate magic yet. > > Any tips or pointers or nudges for an openlayers newbie? > > Thanks, > > Curt. > -- > Curtis Olson: > http://www.atiak.com - http://aem.umn.edu/~uav/ > http://www.flightgear.org - http://gallinazo.flightgear.org > > > > _______________________________________________ > Users mailing > [email protected]http://lists.osgeo.org/mailman/listinfo/openlayers-users > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users > > -- Curtis Olson: http://www.atiak.com - http://aem.umn.edu/~uav/ http://www.flightgear.org - http://gallinazo.flightgear.org
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
