On 3-1-2011 23:37, paweluz wrote:
Thank you for the info about that page! I found there very interesting stuff. I was trying to update my code, and make it work...but unfortunately I have not succeed. My code looks like that now:var map = new OpenLayers.Map("map", { projection: new OpenLayers.Projection("EPSG:900913"), }); var myBaseLayer = new OpenLayers.Layer.Google("Google", {'sphericalMercator': true, 'maxExtent': new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34) }); map.addLayer(myBaseLayer); var geom ="LINESTRING(15.535221 51.938251,15.534851 51.938159,15.53443 51.938121,15.533781 51.938148,15.533221 51.938159,15.53292 51.938179,15.53286 51.937881)"; var options1 = {projection: "EPSG:4326"}; var vectorLayer = new OpenLayers.Layer.Vector("Vector Layer",options1); map.addLayer(vectorLayer); var streetGeom = new OpenLayers.Geometry.fromWKT(geom); var streetFeature = new OpenLayers.Feature.Vector(streetGeom); vectorLayer.addFeatures([streetFeature]); var bounds1 = streetFeature.geometry.getBounds(); map.zoomToExtent(bounds1); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl(new OpenLayers.Control.MousePosition({numDigits:6})); Zooming go in the middle of ocean - not good at all... Can anyone see any error in code? Regards, Paul
Paul,I am not quite sure, but I think you need to transform your linestring from 4326 to 900913. Not everything is automatic with OpenLayers. bbox.transform(new OpenLayers.Projection('EPSG:4326'), new OpenLayers.Projection('EPSG:900913'));
In the above snippet bbox is an OpenLayers.Bounds. Kind regards, Jan
<<attachment: j_vanderven.vcf>>
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
