I would like to draw a line between few GPS coordination. I tried to use OpenLayers.Geometry.LineString for that, but it uses a OpenLayers.Geometry.Point. Is there any function in OpenLayers that converts GPS coordination (latlon) to Geometry.Point? Or maybe I'm doing this wrong and shouldn't use lineString for drawing a line between latlon points?
1 Answer
These commands first create an array of points that is then used to create a line:
var points = new Array(
new OpenLayers.Geometry.Point(lon1, lat1),
new OpenLayers.Geometry.Point(lon2, lat2)
);
var line = new OpenLayers.Geometry.LineString(points);