[OpenLayers-Users] Adding a line to a map in google maps.

JuKiM rifins at gmail.com
Mon Jan 25 11:02:07 EST 2010


Hi,

I have a google maps, and I add a line to the map, but when I drag the map,
the line changes its position..

I draw with this:

                    var p1 = new OpenLayers.Geometry.Point(0.1, 40);
            var p2 = new OpenLayers.Geometry.Point(0.2, 40);
            var p3 = new OpenLayers.Geometry.Point(0.3, 40);
            var p4 = new OpenLayers.Geometry.Point(0.4, 40);
            var p5 = new OpenLayers.Geometry.Point(0.5, 40);
            var p6 = new OpenLayers.Geometry.Point(0.6, 40);
            var p7 = new OpenLayers.Geometry.Point(0.7, 40);
            var p8 = new OpenLayers.Geometry.Point(0.8, 40);
            var p9 = new OpenLayers.Geometry.Point(0.9, 40);
            var p10 = new OpenLayers.Geometry.Point(0, 41);

            var points = [];
            points.push(p1);
            points.push(p2);
            points.push(p3);
            points.push(p4);
            points.push(p5);
            points.push(p6);
            points.push(p7);
            points.push(p8);
            points.push(p9);
            points.push(p10);

            // create a line feature from a list of points
            var lineString = new OpenLayers.Geometry.LineString(points);
            var lineFeature = new OpenLayers.Feature.Vector(lineString,
null, style_green);

I see the line like an "arrow head", but when I drag the map, the vertex
points another place... Where is the problem??

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100125/9275abc8/attachment.html


More information about the Users mailing list