[OpenLayers-Users] Koordinaten Format LonLat vs. LatLon

Andreas Hocevar ahocevar at opengeo.org
Mon Jun 25 08:39:36 PDT 2012


You can customize the output of the MousePosition control:

var control = new OpenLayers.Control.MousePosition();
control.formatOutput = function(lonlat) {
    return [lonlat.lat, lonlat.lon].join(", ");
};

Andreas.

On Wed, Jun 13, 2012 at 10:19 AM, Marco Krage <marco at my-azur.de> wrote:
> Hello,
> for example i use map.addControl(new OpenLayers.Control.MousePosition());
> The User takes the coord shown by MousePosition() on the Map an use it on
> maps.google.de
>
> It would point him to an diffrent place. Because google maps need
> 51.512161,7.465782 not 7.465782,51.512161 to show "Dortmund City"
>
>
> Zitat von Andreas Hocevar <ahocevar at opengeo.org>:
>
>> Your GPX tracks should work fine. The only thing is that OpenLayers has an
>> unusual LonLat class, whereas other frameworks have LatLng or something
>> similar. The tracks should get drawn correctly, and if you look at the
>> properties of the LonLat object, you will see that latitude and longitude
>> are assigned correctly.
>>
>> What exactly were you looking at when you saw the reversed coordinates?
>>
>> Andreas.
>>
>> On Wednesday, June 13, 2012, Marco Krage <marco at my-azur.de> wrote:
>>>
>>> Hallo,
>>> ich beginne gerade mit Openlayers und möchte gerne meine GPX Tracks
>>
>> darstellen.
>>>
>>> Was ich nun nicht ganz verstehe ist, wieso Openlayers die Koordinaten nur
>>
>> im LonLat Format annimmt und ausgibt.
>>>
>>>
>>> Alle Quellen, sei es Google Maps oder GPX Tracks liefern die Koordinaten
>>
>> im LatLon Format.
>>>
>>>
>>> Google Maps (Dortmund City): 51.512161,7.465782
>>> GPS Tracker (Dortmund City): 51.512161,7.465782
>>> Openlayers (Dortmund City): 7.465782,51.512161
>>>
>>> Wie soll ich damit umgehen, dass Openlayers die Koordinaten umgekehrt
>>
>> annimmt?
>>>
>>>
>>> Gruß Marco
>>>
>>> --
>>> www.my-azur.de - einfach wunderbar
>>>
>>> _______________________________________________
>>> 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.
>>
>
>
> --
> www.my-azur.de - einfach wunderbar
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list