Hi, the wkt should look like this: LINESTRING(-1868732.4672518407 1839380.6483942936,-1311047.9089619524 1100693.2071508842) In your case you have LINESTRING((... ...,... ...)) with double bracket. Arnd
_____ Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von karsten vennemann Gesendet: Freitag, 18. September 2009 10:15 An: 'Michael Shishcu' Cc: users@openlayers.org Betreff: Re: [OpenLayers-Users] adding feature to vectorlayer from wkt ok added this in: var options1 = {units: 'm', projection: "EPSG:102003", maxExtent: new OpenLayers.Bounds(-2500000,-1500000,2500000,1500000)}; vectorlayer = new OpenLayers.Layer.Vector("Vector Layer",{layers: 'basic'},options1); var thestreetgeom = new OpenLayers.Geometry.fromWKT({type:"LineString"}, {coordinates:[[-1930473.64430529, 1513488.44352758], [-1646969.91778704, 1155135.05969326]]},{ style: "default" }); vectorlayer.addFeatures(thestreetgeom); also added bounds1 = thestreetgeom.geometry.getBounds(); map.zoomToExtent(bounds1); Still nothing shows. I was not sure which bounds to take since the wkt will be dynamically selected form the roads layer out of postgis. So I added the bounds ofr the whole map - no idea if this is valid but no errors there. To check the bounds again I added the two lines above to get the actuakl bounds and to zoom to the feature location. Using Firebug I found that the inital syntax of the linestirng had one point that was not recognized - no idea why but it said 'NaN' . The result was that thestreetgeom was undefined. Thus I changed it to the above notation for thestreetgeom and got an object now. However I get an error now: thestreetgeom.geometry is undefined So my feature object has no geometry defined - no idea why... Karsten _____ From: Michael Shishcu [mailto:mickl...@gmail.com] Sent: Friday, September 18, 2009 00:17 To: karsten vennemann Cc: users@openlayers.org Subject: Re: [OpenLayers-Users] adding feature to vectorlayer from wkt well, try to add the max extend of the layer and map units (the next is for meters) var options1 = {units: 'm', projection: "EPSG:102003", maxExtent: new OpenLayers.Bounds(xmin, ymin, xmax, ymax)}; 2009/9/18 karsten vennemann <kars...@terragis.net> hmm I tried now var options1 = {projection: "EPSG:102003"}; vectorlayer = new OpenLayers.Layer.Vector("Vector Layer",{layers: 'basic'},options1); map.addLayer(vectorlayer); var thestreetgeom = new OpenLayers.Geometry.fromWKT("LINESTRING((-1930473.64430529 1513488.44352758, -1646969.91778704 1155135.05969326))", { style: "default" }); vectorlayer.addFeatures(thestreetgeom); but still nothing shows and no error... Karsten _____ From: Michael Shishcu [mailto:mickl...@gmail.com] Sent: Thursday, September 17, 2009 23:55 To: karsten vennemann Cc: users@openlayers.org Subject: Re: [OpenLayers-Users] adding feature to vectorlayer from wkt Hi, Karsten maybe your layer does not have the correct projection? try var options = {..., projection: "EPSG:102003", ... }; vectorlayer = new OpenLayers.Layer.Vector("Vector Layer",{layers: 'basic'},options ); regards, michael 2009/9/18 karsten vennemann <kars...@terragis.net> I am trying to add line features to a vector feature layer in my map (projection is EPSG:102003, as are the coordinates of the wkt below) vectorlayer = new OpenLayers.Layer.Vector("Vector Layer"); map.addLayer(vectorlayer); var thestreetgeom = new OpenLayers.Geometry.fromWKT("LINESTRING((-1930473.64430529 1513488.44352758, -1646969.91778704 1155135.05969326))", { style: "default" }); vectorlayer.addFeatures(thestreetgeom); I do not get any error but nothing shows on my map. Could this still be a projection problem or am I missing something else ? Karsten Terra GIS LTD Seattle, USA <http://www.terragis.net/> www.terragis.net _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users