<span style>Hi all,</span><div style><br></div><div style>I think I have figured this out -- after some tedious back and forth through the documentation and dumping out intermediate structures with &quot;alert&quot;.</div>

<div style><br></div><div style>If I start with this:</div><div class="im" style><div><br></div><div>var route_points = new Array();</div></div><div style>var multipoint = new OpenLayers.Geometry.MultiPoint(route_points);</div>

<div style>var route = new OpenLayers.Feature.Vector(multipoint); <div>myLayer.addFeatures( route );</div><div><br></div><div>Then later I can get the point list by accessing: </div><div><br></div><div>var pts = route.geometry.components;</div>

<div><br></div><div>Then I can modify a point by:</div><div><br></div><div>pts[3].lon = newlon;</div><div>pts[3].lat = newlat;</div><div><br></div><div>And then I need to call myLayer.redraw() to see the change.  I can add or remove points to this list as well.  Seems to do the trick!</div>

<div><br></div><div>Thanks,</div><div><br></div><div>Curt.</div><div><br></div></div><br><div class="gmail_quote">On Thu, Apr 12, 2012 at 12:01 PM, Michael <span dir="ltr">&lt;<a href="mailto:mdm@yachtpc.com">mdm@yachtpc.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi Curt<br>
    <br>
    Yes, as I recall (and I will dig into my code as soon as I pay
    bills) a copy is constructed.  So you need to walk through the
    points in the line itself and find the one that matches the one you
    want to change (I gave them all ids).  THEN change it, THEN redraw
    the line.  If you are doing a lot of lines or points, do them all
    then redraw the layer.<span class="HOEnZb"><font color="#888888"><br>
    <br>
    Michael</font></span><div><div class="h5"><br>
    <br>
    On 4/12/2012 9:36 AM, Curtis Olson wrote:
    <blockquote type="cite">Hi Michael (and everyone else who replied),
      <div><br>
        Thanks for your quick replies.  I&#39;m working on this some more
        today and have some follow up questions.</div>
      <div><br>
      </div>
      <div>I define my point list in the global scope:</div>
      <div><br>
        <div>
          <div>var route_points = new Array();<br>
            <br>
          </div>
          <div>Then I populate this array with a few points.</div>
          <div><br>
          </div>
          <div>Finally I can build the structures and add the result to
            a layer so I can see it (and I do see the result.)</div>
          <div><br>
          </div>
          <div>
            <div>lineString = new
              OpenLayers.Geometry.LineString(route_points);</div>
            <div>route_vector = new
              OpenLayers.Feature.Vector(lineString,null,home_style);</div>
            <div>routeLayer.addFeatures( route_vector );</div>
          </div>
          <div><br>
          </div>
          <div>Later I go back and change the location of a point in my
            route_list array of points.</div>
          <div><br>
          </div>
          <div>route_points[2].lon = newlon;</div>
          <div>route_points[2].lat = newlat;</div>
          <div><br>
          </div>
          <div>But nothing changes on screen.  (for what it&#39;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&#39;s as a new feature along with the old --
            I&#39;m hoping to be able to simply modify the old structure
            rather than having to create a new (potentially
            large/complex) structure each iteration.</div>
          <div><br>
          </div>
          <div>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.</div>
          <div><br>
          </div>
          <div>I wouldn&#39;t mind using accessor functions to find the
            actual data point, but as I look through the class
            definitions and inheritance, I don&#39;t see any way to get back
            to the original point array when starting from a Vector() or
            a LineString()?</div>
          <div><br>
          </div>
          <div>I&#39;m probably missing something stupid or easy, but I&#39;m
            just not seeing it?  Am I on the right track or missing by a
            mile?</div>
          <div><br>
          </div>
          <div>Thanks,</div>
          <div><br>
          </div>
          <div>Curt.</div>
          <div>
            <br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div class="gmail_quote">On Wed, Apr 11, 2012 at 2:22 PM,
            Michael <span dir="ltr">&lt;<a href="mailto:mdm@yachtpc.com" target="_blank">mdm@yachtpc.com</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> 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.<br>
                <br>
                In my application, I maintained a separate array
                pointing to the points in my line.  Possibly not the
                most efficient, but it worked.<br>
                <br>
                Michael
                <div>
                  <div><br>
                    <br>
                    On 4/11/2012 12:08 PM, Curtis Olson wrote: </div>
                </div>
                <blockquote type="cite">
                  <div>
                    <div>
                      <div>Hi,</div>
                      <div><br>
                      </div>
                      I&#39;ve begun my plunge into openlayers and have a
                      number of things working, but I&#39;ve run into a
                      question that I haven&#39;t been able to answer for
                      myself from the docs and the mailing list
                      archives.
                      <div> <br>
                      </div>
                      <div>I am building a map that will live track an
                        object (for example: my aircraft location as I
                        fly in the FlightGear flight simulator.)</div>
                      <div><br>
                      </div>
                      <div>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.</div>
                      <div><br>
                        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.</div>
                      <div><br>
                        Is something like this possible or am I barking
                        up the wrong tree?</div>
                      <div><br>
                      </div>
                      <div>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?</div>
                      <div><br>
                        I&#39;ve been hunting through the examples and the
                        documentation and haven&#39;t stumbled on the
                        appropriate magic yet.</div>
                      <div><br>
                      </div>
                      <div>Any tips or pointers or nudges for an
                        openlayers newbie?</div>
                      <div> <br>
                        Thanks,</div>
                      <div><br>
                      </div>
                      <div>Curt.<br>
                        -- <br>
                        <div>
                          <div>Curtis Olson:</div>
                          <div><a href="http://www.atiak.com" target="_blank">http://www.atiak.com</a> -
                            <a href="http://aem.umn.edu/%7Euav/" target="_blank">http://aem.umn.edu/~uav/</a></div>
                          <div><a href="http://www.flightgear.org" target="_blank">http://www.flightgear.org</a>
                            - <a href="http://gallinazo.flightgear.org" target="_blank">http://gallinazo.flightgear.org</a></div>
                        </div>
                        <br>
                      </div>
                      <br>
                      <fieldset></fieldset>
                      <br>
                    </div>
                  </div>
                  <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
                </blockquote>
              </div>
              <br>
              _______________________________________________<br>
              Users mailing list<br>
              <a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
              <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
              <br>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div>
            <div>Curtis Olson:</div>
            <div><a href="http://www.atiak.com" target="_blank">http://www.atiak.com</a> - <a href="http://aem.umn.edu/%7Euav/" target="_blank">http://aem.umn.edu/~uav/</a></div>
            <div><a href="http://www.flightgear.org" target="_blank">http://www.flightgear.org</a>
              - <a href="http://gallinazo.flightgear.org" target="_blank">http://gallinazo.flightgear.org</a></div>
          </div>
          <br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
    </blockquote>
  </div></div></div>

<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div>Curtis Olson:</div><div><a href="http://www.atiak.com" target="_blank">http://www.atiak.com</a> - <a href="http://aem.umn.edu/~uav/" target="_blank">http://aem.umn.edu/~uav/</a></div>

<div><a href="http://www.flightgear.org" target="_blank">http://www.flightgear.org</a> - <a href="http://gallinazo.flightgear.org" target="_blank">http://gallinazo.flightgear.org</a></div></div><br>