[OpenLayers-Users] map.getCenter function question
Andreas Hocevar
ahocevar at opengeo.org
Mon Jun 20 15:51:47 EDT 2011
Hi,
try EPSG:4326 for the lat and lon you pass to the Twitter API.
Andreas.
On Jun 20, 2011, at 20:43 , Nicholas Efremov-Kendall wrote:
> 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?
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list