Hi Andreas,<div><br></div><div>Thanks for the suggestion. With the following code</div><div><div><br></div><div>var temp = map.getCenter().transform(new OpenLayers.Projection(&quot;EPSG:4326&quot;),map.getProjectionObject());</div>
</div><div><br></div><div>I now get another error, it seems to be passing a non number to the lat field (NaN) for some reason. The full script is below...</div><div><br></div><div><span class="Apple-style-span" style="color: rgb(255, 0, 0); font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap; "><a href="http://search.twitter.com/search.json?=&amp;geocode=NaN%2C-1115282612432.1%2C50km&amp;rpp=100&amp;callbacl=jQuery161005863115028478205_1308599949840&amp;_=1308599980262" class="webkit-html-resource-link" title="http://search.twitter.com/search.json?=&amp;geocode=NaN%2C-1115282612432.1%2C50km&amp;rpp=100&amp;callbacl=jQuery161005863115028478205_1308599949840&amp;_=1308599980262" style="box-sizing: border-box; color: rgb(84, 84, 84); cursor: pointer; max-width: 100%; ">http://search.twitter.com/search.json?=&amp;geocode=NaN%2C-1115282612432.1%2C50km&amp;rpp=100&amp;callbacl=jQuery161005863115028478205_1308599949840&amp;_=1308599980262</a> </span></div>
<div><br></div><div><div><br></div><div><br></div><div><br></div><div><br></div><div><div>var feat, OpenLayers, latlon;</div><div>var tweetz = new OpenLayers.Layer.Vector(&quot;Tweetz&quot;,{styleMap: new OpenLayers.StyleMap({externalGraphic: &quot;OpenLayers-2.11-rc1/img/marker.png&quot;, pointRadius: 10})});</div>
<div>var map = new OpenLayers.Map(&#39;map&#39;);</div><div>var tweets = [];</div><div>var tweetsQ = [];</div><div>var refreshQuery = &#39;?=&#39;;</div><div>// Need something here for popups or marker lables</div><div>function initGIS(){</div>
<div>map.addControl(new OpenLayers.Control.LayerSwitcher());</div><div>var mapnik = new OpenLayers.Layer.OSM();</div><div>map.addLayer(mapnik);</div><div>map.setCenter(new OpenLayers.LonLat(-90, 38).transform(new OpenLayers.Projection(&quot;EPSG:4326&quot;),map.getProjectionObject()),12);</div>
<div>$(document).everyTime(&#39;30s&#39;, acquireTweets);</div><div>$(document).everyTime(&#39;100ms&#39;, parseTweetsQ);</div><div>getLoc();</div><div>} </div><div><br></div><div><br></div><div>//jQuery(window).ready(function(){jQuery(&quot;#btnInit&quot;).click(getLoc);});</div>
<div><br></div><div><br></div><div><br></div><div>function getLoc(){</div><div>if (Modernizr.geolocation) {</div><div> navigator.geolocation.getCurrentPosition(plotLoc,handle_error,createTWTsrcURL);</div><div>} else {</div>
<div>yqlgeo.get(&#39;visitor&#39;,norm_yql_resp);</div><div>}</div><div>}</div><div><br></div><div>function plotLoc (position){</div><div>var latlon = new OpenLayers.LonLat(position.coords.latitude,position.coords.longitude).transform(new OpenLayers.Projection(&quot;EPSG:4326&quot;),map.getProjectionObject());</div>
<div>var marker = new OpenLayers.Layer.Markers(&quot;Marker&quot;);</div><div>map.addLayer(marker);</div><div>marker.addMarker(new OpenLayers.Marker(latlon));</div><div>map.setCenter(latlon,14);</div><div>acquireTweets();</div>
<div>}</div><div><br></div><div>function createTWTsrcURL (){</div><div>var temp = map.getCenter().transform(new OpenLayers.Projection(&quot;EPSG:4326&quot;),map.getProjectionObject());</div><div>return &#39;<a href="http://search.twitter.com/search.json">http://search.twitter.com/search.json</a>&#39; + refreshQuery + &#39;&amp;geocode=&#39; + temp.lat +&#39;%2C&#39; + temp.lon + &#39;%2C50km&amp;rpp=100&amp;callbacl=?&#39;;</div>
<div>}</div><div><br></div><div>function acquireTweets(){</div><div>$.getJSON(createTWTsrcURL(), function(data){</div><div>if(data.results)</div><div>$.each(data.results, function(i, tweet){</div><div>if (tweet.geo || tweet.location)</div>
<div>tweetQ.push(tweet);</div><div>});</div><div>refreshQuery = data.refresh_url;</div><div>});</div><div>}</div><div><br></div><div>function parseTweetsQ(){</div><div>if (tweetsQ.length &gt; 0) {</div><div>var tweet = tweetsQ.pop();</div>
<div>if (tweet.geo){</div><div>tweet.latlng = new OpenLayers.LatLong(tweet.geo.coordinates[0],tweet.geo.coordinates[1]);</div><div>plotTweet(tweet);</div><div>}</div><div>}</div><div>}</div><div><br></div><div>function createInfoContent(tweet) {</div>
<div>var retval = &#39;&#39;;</div><div>retval += &#39;&lt;div class=&quot;tweet_info&quot;&gt;&#39;;</div><div>retval += &#39;&lt;img alt=&quot;&#39; + tweet.from_user_id + &#39;&quot; src=&quot;&#39; +</div><div>tweet.profile_image_url + &#39;&quot; class=&quot;tweet_profile&quot;/&gt;&#39;;</div>
<div>retval += &#39;&lt;h3&gt;&#39; + tweet.from_user + &#39;&lt;/h3&gt;&#39;;</div><div>retval += &#39;&lt;p&gt;&#39; + tweet.text + &#39;&lt;/p&gt;&#39;;</div><div>retval += &#39;&lt;p&gt;Source: &lt;a href=&quot;&#39; + tweet.source + &#39;&quot;/&gt;&#39; +</div>
<div>tweet.source + &#39;&lt;/a&gt;&lt;/p&gt;&#39;;</div><div>retval += &#39;&lt;/div&gt;&#39;;</div><div>return retval;</div><div>}</div><div><br></div><div>function plotTwt(tweet){</div><div>tweet.marker = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(tweet.latlng).transform(new OpenLayers.Projection(&quot;EPSG:4326&quot;),map.getProjectionObject()));</div>
<div><br></div><div>}</div><div><br></div><div>function handle_error(error) {</div><div>switch(error.code){</div><div>case error.PERMISSION_DENIED: alert(&quot;This application reguires you to agree to share your location. Please reload the page to see it work properly. There is a privacy disclaimer at the bottom of this page. This site does not currently record or store these data, and in the future will not record unique user information without informing the user or asking their permission. -Virtual Spatiality&quot;);</div>
<div>break;</div><div>  </div><div>case error.POSITION_UNAVAILABLE: alert(&quot;could not determine position&quot;);</div><div>break;</div><div>  </div><div>case error.TIMEOUT: alert(&quot;timeout retrieving position&quot;);</div>
<div>break;</div><div>  </div><div>default: alert(&quot;unknown error&quot;);</div><div>break;</div><div>}</div><div>}</div><div><br></div><div>function norm_yql_resp(response){</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (response.error) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>var error = {code : 0};</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>handle_error(error);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>var position = {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>coords:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>latitude: response.place.centroid.latitude,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>longitude: response.place.centroid.longitude</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>},</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>address :</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>city: response.place.locality2.content,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>region: response.place.admin1.content,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>country: response.place.country.content</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>};</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>handle_geolocation_query(position);</div><div>}</div><br><div class="gmail_quote">On Mon, Jun 20, 2011 at 2:51 PM, Andreas Hocevar <span dir="ltr">&lt;<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
try EPSG:4326 for the lat and lon you pass to the Twitter API.<br>
<br>
Andreas.<br>
<div><div></div><div class="h5"><br>
On Jun 20, 2011, at 20:43 , Nicholas Efremov-Kendall wrote:<br>
<br>
&gt; Hi all,<br>
&gt;<br>
&gt; Still messing around with the geolocation API. I&#39;ve been playing with the jquery getJSON function for cross-domain requests and I&#39;m running into an issue that I think is related to the coordinate system of my map, which is using OSM as a baselayer.<br>

&gt;<br>
&gt; Essentially I&#39;m trying to apply holdener&#39;s nearby tweet&#39;s and I&#39;m getting a 403 error from the getJSON function. I think this is because I&#39;m not transforming the map.getCenter() properly, and I assume that the twitter API uses Google&#39;s EPSG 900913 as a default.<br>

&gt;<br>
&gt; this is the function I&#39;m using to create the search URL<br>
&gt;<br>
&gt; function createTWTsrcURL (){<br>
&gt; var temp = map.getCenter().transform(new OpenLayers.Projection(&quot;EPSG:900913&quot;),map.getProjectionObject());<br>
&gt; return &#39;<a href="http://search.twitter.com/search.json" target="_blank">http://search.twitter.com/search.json</a>&#39; + refreshQuery + &#39;&amp;geocode=&#39; + temp.lat +&#39;%2C&#39; + temp.lon + &#39;%2C50km&amp;rpp=100&amp;callbacl=?&#39;;<br>

&gt; }<br>
&gt;<br>
&gt; You can see from the get string which is producing the 403 error (Forbidden) that the script isn&#39;t passing Lat-Longs to the search API, which might be causing this error.<br>
&gt; <a href="http://search.twitter.com/search.json?=&amp;geocode=4579425.8122326%2C-10018754.17%2C50km&amp;rpp=100&amp;callbacl=jQuery16105243276595138013_1308594913395&amp;_=1308595036601" target="_blank">http://search.twitter.com/search.json?=&amp;geocode=4579425.8122326%2C-10018754.17%2C50km&amp;rpp=100&amp;callbacl=jQuery16105243276595138013_1308594913395&amp;_=1308595036601</a><br>

&gt;<br>
&gt; I&#39;m sure I&#39;m not transforming it correctly, even if that&#39;s not what is causing the 403 error. Any ideas?<br>
</div></div>&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
<br>
</font></blockquote></div><br></div></div>