<font color="#000080" face="Arial" size="2"><span>OpenLayers.Geometry.fromWKT( ) </span></font>recieves string as parameter<br>try <font face="Arial" size="2">var thestreetgeom = new
OpenLayers.Geometry.fromWKT("LINESTRING((-1930473.64430529 1513488.44352758,
-1646969.91778704<span> </span>1155135.05969326))); </font><br><br><br><br><div class="gmail_quote">2009/9/18 karsten vennemann <span dir="ltr"><<a href="mailto:karsten@terragis.net">karsten@terragis.net</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span>ok added this in:</span></font></div>
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span>var options1 = {units: 'm', projection: "EPSG:102003",
maxExtent: new
OpenLayers.Bounds(-2500000,-1500000,2500000,1500000)}; </span></font></div><div class="im">
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span>vectorlayer = new OpenLayers.Layer.Vector("Vector
Layer",{layers:
'basic'},options1);
</span></font></div>
</div><div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span>var thestreetgeom = new
OpenLayers.Geometry.fromWKT({type:"LineString"},
{coordinates:[[-1930473.64430529, 1513488.44352758], [-1646969.91778704,
1155135.05969326]]},{ style: "default"
});<br>vectorlayer.addFeatures(thestreetgeom);<br></span></font></div>
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span>also added </span></font></div>
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span></span></font> </div>
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span>bounds1 =
thestreetgeom.geometry.getBounds();<br>map.zoomToExtent(bounds1);</span></font></div>
<div><font color="#000080" face="Arial" size="2"></font> </div>
<div><span><font color="#000080" face="Arial" size="2">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.</font></span></div>
<div><span><font color="#000080" face="Arial" size="2"></font></span> </div>
<div><span><font color="#000080" face="Arial" size="2">To
check the bounds again I added the two lines above to get the actuakl bounds and
to zoom to the feature location.</font></span></div>
<div><span><font color="#000080" face="Arial" size="2"></font></span> </div>
<div><span><font color="#000080" face="Arial" size="2">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
</font></span></div>
<div><span><font color="#000080" face="Arial" size="2">thestreetgeom was undefined.</font></span></div>
<div><span><font color="#000080" face="Arial" size="2">Thus I
changed it to the above notation for thestreetgeom and got an object now.
However I get an error now:</font></span></div>
<div><span><span><font color="#000080" face="Arial" size="2">thestreetgeom.geometry is
undefined</font></span></span></div>
<div><span><span><font color="#000080" face="Arial" size="2"></font></span></span> </div>
<div><span><span><font color="#000080" face="Arial" size="2">So my feature object has no geometry
defined - no idea why...</font></span></span></div>
<div><font color="#000080" face="Arial" size="2"><span style="font-size: 11pt; font-family: Verdana;">Karsten</span></font></div><br>
<blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><div class="im"><b>From:</b> Michael Shishcu
[mailto:<a href="mailto:micklesh@gmail.com" target="_blank">micklesh@gmail.com</a>] <br></div><b>Sent:</b> Friday, September 18, 2009
00:17<div><div></div><div class="h5"><br><b>To:</b> karsten vennemann<br><b>Cc:</b>
<a href="mailto:users@openlayers.org" target="_blank">users@openlayers.org</a><br><b>Subject:</b> Re: [OpenLayers-Users] adding feature
to vectorlayer from wkt<br></div></div></font><br></div><div><div></div><div class="h5">
<div></div>well, try to add the max extend of the layer and map units (the
next is for meters)<br><font style="color: rgb(0, 0, 0);"><span><font face="Arial" size="2">var options1 = {</font></span></font><span style="color: rgb(0, 0, 0);">units: 'm',</span><font style="color: rgb(0, 0, 0);"><span><font face="Arial" size="2"> projection:
"EPSG:102003", </font></span></font>maxExtent: new OpenLayers.Bounds(xmin,
ymin, xmax, ymax)<font size="+0"><span><font color="#000080" face="Arial" size="2">};</font></span></font><br><br>
<div class="gmail_quote">2009/9/18 karsten vennemann <span dir="ltr"><<a href="mailto:karsten@terragis.net" target="_blank">karsten@terragis.net</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span>hmm I
tried now</span></font></div>
<div dir="ltr" align="left"><font color="#000080" face="Arial" size="2"><span></span></font> </div>
<div dir="ltr" align="left"><font size="+0"><span><font color="#000080" face="Arial" size="2">var options1 = {projection: "EPSG:102003"};<br>vectorlayer = new
OpenLayers.Layer.Vector("Vector Layer",{layers:
'basic'},options1);<br></font>
<div><font color="#000080" face="Arial" size="2">map.addLayer(vectorlayer);<br>var thestreetgeom = new
OpenLayers.Geometry.fromWKT("LINESTRING((-1930473.64430529 1513488.44352758,
-1646969.91778704<span> </span>1155135.05969326))", { style: "default"
}); <br>vectorlayer.addFeatures(thestreetgeom);</font></div></span></font></div>
<div><font color="#000080" face="Arial" size="2"></font> </div>
<p align="left"><span style="font-size: 11pt; font-family: Verdana;"><span><font color="#000080" face="Arial" size="2">but still nothing shows and no
error...</font></span></span></p>
<p align="left"><font size="2"><span style="font-size: 11pt; font-family: Verdana;"><font color="#000080" face="Arial" size="2">Karsten</font> </span></font></p><br>
<blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> Michael Shishcu [mailto:<a href="mailto:micklesh@gmail.com" target="_blank">micklesh@gmail.com</a>]
<br><b>Sent:</b> Thursday, September 17, 2009 23:55<br><b>To:</b> karsten
vennemann<br><b>Cc:</b> <a href="mailto:users@openlayers.org" target="_blank">users@openlayers.org</a><br><b>Subject:</b> Re:
[OpenLayers-Users] adding feature to vectorlayer from
wkt<br></font><br></div>
<div>
<div></div>
<div>
<div></div>Hi, Karsten<br>maybe your layer does not have the correct
projection?<br>try<br> var
options = {..., projection: "EPSG:<font face="Arial" size="2"><span>102003</span></font>", ...
};<br> <font face="Arial" size="2">vectorlayer </font>= new OpenLayers.Layer.Vector("Vector
Layer",{layers: 'basic'},options );<br><br>regards, michael<br><br>
<div class="gmail_quote">2009/9/18 karsten vennemann <span dir="ltr"><<a href="mailto:karsten@terragis.net" target="_blank">karsten@terragis.net</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div><font face="Arial" size="2"><span>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)</span></font></div>
<div><font face="Arial" size="2"><span></span></font> </div>
<div><font face="Arial" size="2">vectorlayer = new
OpenLayers.Layer.Vector("Vector
Layer");<br>map.addLayer(vectorlayer);<br>var thestreetgeom = new
OpenLayers.Geometry.fromWKT("LINESTRING((-1930473.64430529
1513488.44352758, -1646969.91778704<span> </span>1155135.05969326))", {
style: "default"
}); <br>vectorlayer.addFeatures(thestreetgeom);</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><span><font face="Arial" size="2">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 ?</font></span></div>
<div><font size="2"><span style="font-size: 11pt; font-family: Verdana;"><br>Karsten
</span></font><font size="1"><span style="font-size: 9pt; font-family: Verdana;"><br></span></font><font color="#003264"><font size="1"><span style="font-size: 9pt; font-family: Verdana;">Terra GIS
LTD<br></span></font></font><font size="1"><span style="font-size: 9pt; font-family: Verdana;"><font color="#003264"><span>Seattle, </span>USA</font></span></font><font size="1"><span style="font-size: 9pt; font-family: Verdana;"><font color="#003264"> <br>
</font><a href="http://www.terragis.net/" target="_blank"><font color="#003264">www.terragis.net</font></a></span></font></div></div><br>_______________________________________________<br>Users
mailing list<br><a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br><a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div></div></blockquote></div></blockquote></div><br></div></div></blockquote></div>
</blockquote></div><br>