<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16890" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN
class=754520708-18092009>ok added this in:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN
class=754520708-18092009>var options1 = {units: 'm', projection: "EPSG:102003",
maxExtent: new
OpenLayers.Bounds(-2500000,-1500000,2500000,1500000)}; </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN
class=754520708-18092009>vectorlayer = new OpenLayers.Layer.Vector("Vector
Layer",{layers:
'basic'},options1);
</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN
class=754520708-18092009>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 face=Arial color=#000080 size=2><SPAN
class=754520708-18092009>also added </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN
class=754520708-18092009></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN
class=754520708-18092009>bounds1 =
thestreetgeom.geometry.getBounds();<BR>map.zoomToExtent(bounds1);</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#000080 size=2></FONT> </DIV>
<DIV><SPAN class=754520708-18092009><FONT face=Arial color=#000080 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 class=754520708-18092009><FONT face=Arial color=#000080
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=754520708-18092009><FONT face=Arial color=#000080 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 class=754520708-18092009><FONT face=Arial color=#000080
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=754520708-18092009><FONT face=Arial color=#000080 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 class=754520708-18092009><FONT face=Arial color=#000080
size=2>thestreetgeom was undefined.</FONT></SPAN></DIV>
<DIV><SPAN class=754520708-18092009><FONT face=Arial color=#000080 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 class=754520708-18092009><SPAN
class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch"><FONT
face=Arial color=#000080 size=2>thestreetgeom.geometry is
undefined</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=754520708-18092009><SPAN
class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch"><FONT
face=Arial color=#000080 size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=754520708-18092009><SPAN
class="objectBox objectBox-errorMessage hasTwisty hasBreakSwitch"><FONT
face=Arial color=#000080 size=2>So my feature object has no geometry
defined - no idea why...</FONT></SPAN></SPAN></DIV>
<DIV><FONT face=Arial color=#000080 size=2><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana">Karsten</SPAN></FONT></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Michael Shishcu
[mailto:micklesh@gmail.com] <BR><B>Sent:</B> Friday, September 18, 2009
00:17<BR><B>To:</B> karsten vennemann<BR><B>Cc:</B>
users@openlayers.org<BR><B>Subject:</B> Re: [OpenLayers-Users] adding feature
to vectorlayer from wkt<BR></FONT><BR></DIV>
<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 face=Arial color=#000080
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">karsten@terragis.net</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080 size=2><SPAN>hmm I
tried now</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000080
size=2><SPAN></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT size=+0><SPAN><FONT face=Arial color=#000080
size=2>var options1 = {projection: "EPSG:102003"};<BR>vectorlayer = new
OpenLayers.Layer.Vector("Vector Layer",{layers:
'basic'},options1);<BR></FONT>
<DIV class=im><FONT face=Arial color=#000080
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 face=Arial color=#000080 size=2></FONT> </DIV>
<P align=left><SPAN
style="FONT-SIZE: 11pt; FONT-FAMILY: Verdana"><SPAN><FONT face=Arial
color=#000080 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 face=Arial color=#000080
size=2>Karsten</FONT> </SPAN></FONT></P><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,255) 2px solid; MARGIN-RIGHT: 0px">
<DIV lang=en-us dir=ltr align=left>
<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 class=h5>
<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="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<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></BLOCKQUOTE></BODY></HTML>