<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Georgia;
panose-1:2 4 5 2 5 4 5 2 3 3;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Arial","sans-serif";
color:windowtext;}
span.webkit-javascript-keyword
{mso-style-name:webkit-javascript-keyword;}
span.webkit-javascript-ident
{mso-style-name:webkit-javascript-ident;}
span.webkit-block-start
{mso-style-name:webkit-block-start;}
span.webkit-javascript-string
{mso-style-name:webkit-javascript-string;}
span.webkit-javascript-number
{mso-style-name:webkit-javascript-number;}
span.webkit-javascript-comment
{mso-style-name:webkit-javascript-comment;}
span.webkit-block-end
{mso-style-name:webkit-block-end;}
span.EmailStyle25
{mso-style-type:personal-reply;
font-family:"Georgia","serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Georgia","serif";color:#1F497D">Figured it out. theLocal is a LonLat parameter that has a lon , lat attribute, not an x y
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Georgia","serif";color:#1F497D">These are map coordinates not graph ones
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Georgia","serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Dacres, Nehemiah [USA]
<br>
<b>Sent:</b> Monday, October 29, 2012 3:13 PM<br>
<b>To:</b> 'openlayers-users@lists.osgeo.org'<br>
<b>Subject:</b> how might i add features to a map<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I wanted to create a map like this <a href="http://openlayers.org/dev/examples/mobile-jq.html#mappage">
http://openlayers.org/dev/examples/mobile-jq.html#mappage</a> using JqueryMobile and OpenLayers but I wanted to add features using the click handler like in this example <a href="http://openlayers.org/dev/examples/click.html">http://openlayers.org/dev/examples/click.html</a>
but when I activate my click handler to add features coded thusly <span style="font-size:12.0pt;font-family:"Arial","sans-serif"">
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:#AA0D91">function</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> createFeature(theName, theNote, theLocal){<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> </span><span style="font-size:9.0pt;font-family:Consolas;color:#AA0D91">var</span><span style="font-size:9.0pt;font-family:Consolas;color:black">
observationLayer = map.getLayersByName(</span><span style="font-size:9.0pt;font-family:Consolas;color:#C41A16">"customFeatures"</span><span style="font-size:9.0pt;font-family:Consolas;color:black">)[</span><span style="font-size:9.0pt;font-family:Consolas;color:#1C00CF">0</span><span style="font-size:9.0pt;font-family:Consolas;color:black">];</span><span style="font-size:9.0pt;font-family:Consolas;color:#007400">//getLayersByName
</span><span style="font-size:9.0pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> </span><span style="font-size:9.0pt;font-family:Consolas;color:#AA0D91">var</span><span style="font-size:9.0pt;font-family:Consolas;color:black">
point = </span><span style="font-size:9.0pt;font-family:Consolas;color:#AA0D91">new</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> OpenLayers.Geometry.Point(theLocal.x,theLocal.y);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:#AA0D91">var</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> pointFeature =
</span><span style="font-size:9.0pt;font-family:Consolas;color:#AA0D91">new</span><span style="font-size:9.0pt;font-family:Consolas;color:black"> OpenLayers.Feature.Vector(point);
<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> pointFeature.attributes={
<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> name: theName,<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> point:theLocal,
<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> note:theNote<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> };<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black"> observationLayer.addFeatures([pointFeature]);<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">
</span><span style="font-size:9.0pt;font-family:Consolas;color:#007400">// note, the marker icon for this point is declared in the styleMap of the customFeatures layer
</span><span style="font-size:9.0pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:10.5pt;background:white"><span style="font-size:9.0pt;font-family:Consolas;color:black">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial","sans-serif"">What might I be doing wrong. How do I debug this?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Arial","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">Nehemiah I. Dacres<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">Consultant, Booz Allen Hamilton<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>