[OpenLayers-Dev] Map Rotation

Christopher Schmidt crschmidt at metacarta.com
Mon Dec 21 18:14:50 EST 2009


On Mon, Dec 21, 2009 at 03:15:26PM -0800, Alexei Peters wrote:
> 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?

I'd continue to suggest pre-rotating your data, working in a 
projectionless system, is going to be simplest. You can still do the 
proj stuff you want to; you're just going to be writing your own math
from pixels -> geo coordinates anyway, but the map will be in raw
pixels rather than some off-kilter geographic imitation.

-- Chris 

> What do you think?
>  
> -Alexei
>  
>  
> 
> ________________________________
> 
> 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
> discuss.
> 
> WebKit (-webkit-transform) has supported rotations for a while:
> http://developer.apple.com/safari/library/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Transforms/Transforms.html
> 
> Firefox got -moz-transform in 3.5:
> http://developer.mozilla.org/En/CSS/Using_CSS_transforms
> 
> Fall-back for IE (filters *ugh*), but it should work. MIT/GPL, so
> could easily be ported to fit OpenLayers:
> http://paulbakaus.com/2008/08/16/bringing-css-transform-to-internet-explorer/
> 
> 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!
> 
> Gregers
> 
> 

-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list