[OpenLayers-Users] Converting the output of getLonLatFromViewPortPx to spherical coordinates

J. Brian Adams jb_adams at verizon.net
Wed Oct 7 10:33:45 EDT 2009


Thanks Andrea, but sadly I had already tried that to no avail.

The problem seems to be that mapnik (using epsg 4326) is UTM and  
locations are measured in meters from (0, 0) while I need the actual  
spherical coordinates in degrees.

I could work on a function to do the conversion, but before I do I  
wanted to know if this was something that already exists.

Thanks again,

Brian


On Oct 7, 2009, at 3:41 AM, Andreas Hocevar wrote:

> J. Brian Adams wrote:
>> I have been trying to mimic the Click Event Example in which a single
>> mouse click triggers an alert box showing the location of the click  
>> in
>> spherical coordinates (degrees North and Ease.) In my code when I
>> click on a location the alert box shows the coordinates not as  
>> degrees
>> (ie. 40 N -76.2 E) but instead as location (4865946 N, -8482597 E)
>>
>> Since I need to access the data in spherical coordinates, how might I
>> transform the result from what I assume is the epsg4326 projection
>> coordinates to degrees?
>>
>
> Just configure EPSG:4326 as displayProjection of your map, so it looks
> like this:
>
> var map = new OpenLayers.Map("map", {
>    displayProjection: new OpenLayers.Projection("EPSG:4326")
> });
>
> Regards,
> Andreas.
>
>
>
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>




More information about the Users mailing list