[OpenLayers-Users] transformation issues

Nicholas Efremov-Kendall n.e.kendall at gmail.com
Wed Jun 22 18:11:11 EDT 2011


Hi Phil,

I was confused because console.log(map.projection) returned EPSG:4326, I
expected this to be updated with the OSM layer, I guess I don't fully
understand how that works

>
>  var temp = map.getCenter().transform(new
> OpenLayers.Projection("EPSG:900913"),new
> OpenLayers.Projection("EPSG:4326"));
>
>  This should give you temp in long/lat. But why using 900913 instead of
> map.getProjectionObject()?
>

In this case the map.getProjectionObject() wasn't working and would break
the get request to the twitter API, this code returned valid results, or so
I assume.

Your explanation makes sense, I have to transform the points myself, It
might work just to reverse the coords and then transform. if the transform
function is expecting lon-lat, I've been passing it lat-long...

thansk!

What are values of position.coords.longitude/latitude? It makes sense that
> you have to transform lat/long
> to plot them on the OSM projection. In WMS/WFS you are relying on the
> server to transform things to required projection (OL doesnt) but here you
> have to it yourself. It is really at 0,0 - I would expect coords in range of
> -180:180,-90:90 to plot near zero on a map with coordinate range of
> -2E6:-2E6:2E6:2E6.
>
>
>
>
>  Finally, I'm pulling in coordinates from the twitter search api, and I
> can verify that they're in lat-lon, and getting passed to my point. The
> issue is that they're getting places at 0,0. Clearly this is because they're
> not being properly transformed before getting added to the layer,  BUT when
> I apply any of the previous methods to transform the point, my lat value
> gets corrupted into a NAN.
>
> As above, you have to transform them yourself. The only obvious thing that
> I can think of is lat/long are round the wrong way. If you pass -90,334 as a
> latitude then you would get a NaN.
>
> Notice: This email and any attachments are confidential. If received in
> error please destroy and immediately notify us. Do not copy or disclose the
> contents.
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110622/eb9b437d/attachment.html


More information about the Users mailing list