Try var streetFeature = new OpenLayers.Feature.Vector(streetGeom);

On Fri, Sep 18, 2009 at 8:50 PM, karsten vennemann <[email protected]> wrote:
> Ok seem's that I'm almost there. Firebug shows geometry, features and bounds 
> ok. But still nothing shows on the map. I have 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, null, {});
> vectorlayer.addFeatures([streetFeature]);
>
> OI also added
> bounds1 = streetFeature.geometry.getBounds();
> map.zoomToExtent(bounds1);
>
> And the map zooms to the feature extent but the feature is still not showing. 
> Any ideas what is missing ?
> Karsten
>
>
>> -----Original Message-----
>> From: Pavel Iacovlev
>> Sent: Friday, September 18, 2009 02:14
>> Subject: Re: [OpenLayers-Users] adding feature to vectorlayer from wkt
>>
>> You need to add features to your layer and geometries to your feature.
>>
>> var streetGeom = new
>> OpenLayers.Geometry.fromWKT("LINESTRING((-1930473.64430529
>> 1513488.44352758, -1646969.91778704 1155135.05969326))); var
>> streetFeature = new OpenLayers.Feature.Vector(streetGeom,
>> null, {}); vectorLayer.addFeatures([streetFeature]);
>
>



-- 
http://iap.md, The future is open
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to