[OpenLayers-Users] map.getCenter function question

Nicholas Efremov-Kendall n.e.kendall at gmail.com
Mon Jun 20 14:43:43 EDT 2011


Hi all,

Still messing around with the geolocation API. I've been playing with the
jquery getJSON function for cross-domain requests and I'm running into an
issue that I think is related to the coordinate system of my map, which is
using OSM as a baselayer.

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

this is the function I'm using to create the search URL

function createTWTsrcURL (){
var temp = map.getCenter().transform(new
OpenLayers.Projection("EPSG:900913"),map.getProjectionObject());
return 'http://search.twitter.com/search.json' + refreshQuery + '&geocode='
+ temp.lat +'%2C' + temp.lon + '%2C50km&rpp=100&callbacl=?';
}

You can see from the get string which is producing the 403 error (Forbidden)
that the script isn't passing Lat-Longs to the search API, which might be
causing this error.
http://search.twitter.com/search.json?=&geocode=4579425.8122326%2C-10018754.17%2C50km&rpp=100&callbacl=jQuery16105243276595138013_1308594913395&_=1308595036601

I'm sure I'm not transforming it correctly, even if that's not what is
causing the 403 error. Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110620/ef1a26de/attachment.html


More information about the Users mailing list