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

JuKiM rifins at gmail.com
Mon Jan 25 12:17:32 EST 2010


And draw a line in a way like:
var feature = new OpenLayers.Feature(layer, points);
feature.createLine();

Similar at the createMarker?

Thanks!

2010/1/25 Christopher Schmidt <crschmidt at metacarta.com>

> On Mon, Jan 25, 2010 at 05:02:07PM +0100, JuKiM wrote:
> > 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..
>
>
> http://faq.openlayers.org/vector-related-questions/why-dont-my-vector-features-work-over-google-yahoo-virtual-earth-etc/
>
> > 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!
>
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
>
>
> --
> Christopher Schmidt
> MetaCarta
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100125/53f7e85f/attachment.html


More information about the Users mailing list