[OpenLayers-Dev] Map Rotation

Alexei Peters APeters at fargeo.com
Mon Dec 21 18:15:26 EST 2009

Thanks to everyone for all the great feedback on this topic.
I have one thing to add/ask.
In our case we only need to support a map with north pointing east (we don't need to support a user defined rotation for example).
Could one possibly solve this problem by using a custom map projection?  
If we needed to have north point east couldn't we use something like a transversal rotation of 90 degrees.  
Would all we have to do then is build the appropriate Proj.4/Proj.4js files to support something like that?
What do you think?


From: Gregers Gram Rygg [mailto:gregersrygg at gmail.com]
Sent: Mon 12/21/2009 6:02 AM
To: Christopher Schmidt
Cc: Alexei Peters; dev at openlayers.org
Subject: Re: [OpenLayers-Dev] Map Rotation

On Thu, Dec 17, 2009 at 11:41 PM, Christopher Schmidt
<crschmidt at metacarta.com> wrote:
>  1. In Javascript/Images/DOM (ignoring Canvas for the moment), there is
>    no way to make an image exist on an angle.

That depends on what browsers you want to support ;) Most major
browsers now have support for CSS3 transformations that allow us to
rotate to any angle on the client side. Safari, Firefox, Chrome, and a
fall-back option for IE. Hopefully we could find a way to detect the
transform-capability by checking currentStyle or similar, and only
show the control for supported browsers.

I guess we still have to re-write some parts of OpenLayers. Like how
to calculate the map extent, modify getLonLatFromViewPortPx, rewrite
the layers to resize/load tiles when rotated, etc... but we'll get the
caching-benefits of tiling. And we don't have to do anything server
side. Except for labels :/ Which I guess might be a show stopper for
some. Theoretically I guess it would be possible to have several
rotated label-layers, and let the controller decide which is closest
to the current rotation. I.e. label-layer rotated (on map-server) to
North, East, South and West. Then the labels would never be more than
45 degrees off. Another option could be to add labels client-side. But
I don't know much about map-servers, so I'll leave that for others to

WebKit (-webkit-transform) has supported rotations for a while:

Firefox got -moz-transform in 3.5:

Fall-back for IE (filters *ugh*), but it should work. MIT/GPL, so
could easily be ported to fit OpenLayers:

Couldn't find any info about Opera, but they're working on CSS3, and
transformations is in the CSS3 draft
(http://www.w3.org/TR/css3-2d-transforms/). So I guess it's only a
matter of time.

Just a wild thought...
Merry Christmas to everyone!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20091221/4bd0dcbd/attachment.html

More information about the Dev mailing list