[OpenLayers-Users] adding feature to vectorlayer from wkt
karsten vennemann
karsten at terragis.net
Fri Sep 18 14:07:26 EDT 2009
This works now:
var options1 = {layers: 'basic', units: 'm', projection: "EPSG:102003", maxExtent: new OpenLayers.Bounds(-2500000,-1500000,2500000,1500000)}; vectorlayer = new OpenLayers.Layer.Vector("Vector Layer",options1);
map.addLayer(vectorlayer);
var streetGeom = new OpenLayers.Geometry.fromWKT("LINESTRING(-1930473.64430529 1513488.44352758, -1646969.91778704 1155135.05969326)");
var streetFeature = new OpenLayers.Feature.Vector(streetGeom);
vectorlayer.addFeatures([streetFeature]);
bounds1 = streetFeature.geometry.getBounds();
map.zoomToExtent(bounds1);
Thanks to all
Karsten
More information about the Users
mailing list