[OpenLayers-Users] Bounds / Projection
Andreas Hocevar
ahocevar at opengeo.org
Mon Sep 21 12:05:03 EDT 2009
You could try the transformation service on http://proj4js.org/
If you want to transform programmatically, try
var extent = new OpenLayers.Bounds(-13.5,51.5,-4.5,55.5 ).transform(
new OpenLayers.Projection("EPSG:4326),
new OpenLayers.Projection("EPSG:900913)
);
Regards,
Andreas.
eoinyp wrote:
> Thank you Alexandre,
> I now realise that the (-180,-90,180,90) system wont work because Im using
> EPSG:900913, spherical mercator, which is where The projection
> maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508.34)
> comes in.
> Thank you.
> But Im still stuck as to how to set the map to focus on Ireland. I dont
> understand how to define the bounds of a suitable box. Can you give me any
> pointers there?
> Thanks,
>
> Eoinyp.
>
>
>
>
>
> Alexandre Dube wrote:
>
>> Hi,
>>
>> This should helps :
>>
>> http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#Projections
>>
>> Regards,
>>
>> Alexandre
>>
>> eoinyp wrote:
>>
>>> Hi all,
>>> Could someone please explain how to define the bounds of a map?
>>>
>>> I want to centre my map on Ireland when it initialises, but I am having
>>> trouble with the bounds arguments.
>>> As I understand it, the maxExtent of the globe is (-180,-90,180,90)
>>> A box around Ireland using the same coordinate system is (-13.5, 51.5,
>>> -4.5,
>>> 55.5)
>>> So shouldnt I be defining my map as:
>>> maxExtent: new OpenLayers.Bounds(-13.5,51.5,-4.5,55.5 )
>>> ?
>>> This doesnt work, unsurprisingly.
>>> I found somewhere else the bounds of the world defined as:
>>> maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508,
>>> 20037508.34)
>>> which works great, but it shows the entire globe, as I said, I want to
>>> focus
>>> on Ireland.
>>> What coordinate system is this? and how do I translate the area I want to
>>> map to this coordinate system?
>>>
>>> The variable maxResolution also seems to vary from map to map, I am not
>>> sure
>>> what this should be set to.
>>> The documentation doesnt give any idea of the range of appropriate
>>> values.
>>> Thanks,
>>>
>>> Eoinyp.
>>>
>>>
>>>
>> --
>> Alexandre Dubé
>> Mapgears
>> www.mapgears.com
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>>
>
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list