[OpenLayers-Dev] Map Rotation

Bob Basques Bob.Basques at ci.stpaul.mn.us
Sat Dec 19 04:06:56 EST 2009


All,

I think there may be a couple of options (not positive about these):

I think a run time substitution might work:
http://mapserver.org/cgi/runsub.html

or

parameters via a URL : http://mapserver.org/cgi/controls.html

They each have their own dependencies.  

There are also a few notes on implementing the ANGLE param in the map
file:

ANGLE [double]

    Angle, given in degrees, to rotate the map. Default is 0. The
rendered map will rotate in a clockwise direction. The following are
important notes:

        * Requires a PROJECTION object specified at the MAP level and
for each LAYER object (even if all layers are in the same projection).
        * Requires MapScript (SWIG, PHP MapScript). Does not work with
CGI mode.
        * If using the LABEL object’s ANGLE or the LAYER object’s
LABELANGLEITEM parameters as well, these parameters are relative to the
map’s orientation (i.e. they are computed after the MAP object’s ANGLE).
For example, if you have specified an ANGLE for the map of 45, and then
have a layer LABELANGLEITEM value of 45, the resulting label will not
appear rotated (because the resulting map is rotated clockwise 45
degrees and the label is rotated counter-clockwise 45 degrees).
        * More information can be found on the MapRotation Wiki Page.





bobb



>>> Stephen Woodbridge <woodbri at swoodbridge.com> 12/18/09 11:12 PM >>>
Well, I would differ to any of the OL devs, but here is my 2 cents.

I am thinking that the fundamental problem is the OL needs to make 
requests for an image and the request needs to be able to be interpreted

by mapserver or whomever is serving the image. So if you pan to the 
right you need to make sure that the coordinated of the view in your 
request to mapserver return the appropriate image that you would expect 
after the pan. This would be true as well for zooms, and any other OL 
interactions like mouse position controls and such.

One idea might be to define a projection that in effect does the 
appropriate rotation that mapserver is applying. But I'm not sure how 
the requests should be make to mapserver since (see note below) you can 
not use the CGI interface is the docs are correct. My guess is that you 
would have to write a new OpenLayers.Layer.Mapserver.Rotated class the 
understands how to appropriately make the requests to mapserver. And 
probably have to write a mapscript handler to receive the requests and 
generate the image.

Also read the fine print on the MAP ANGLE parameter. I believe it says 
that only works with mapscript and NOT the CGI interface.

-Steve W

Alexei Peters wrote:
> 
> So, if using GeoServer, does the ANGLE parameter apply to all features

> (WFS, WMS, tilecaches, etc..)? 
> Also, you mention that OL has to know how to handle the rotation.  I 
> don't think there's a setting for this now, though, right?
>  
> Is there anyone on the OL team that's thinking about how to handle
this?
>  
> 
> *From:* Andrea Aime [mailto:aaime at opengeo.org]
> *Sent:* Fri 12/18/2009 2:38 AM
> *To:* Stephen Woodbridge
> *Cc:* Christopher Schmidt; Alexei Peters; dev at openlayers.org
> *Subject:* Re: [OpenLayers-Dev] Map Rotation
> 
> Stephen Woodbridge ha scritto:
>  > Christopher Schmidt wrote:
>  >> On Thu, Dec 17, 2009 at 02:39:41PM -0800, Alexei Peters wrote:
>  >>> Hi Everyone,
>  >>> I currently work for a small GIS consulting firm and one of the 
> projects we're currently working on has a potential requirement for 
> rotating the map (so north doesn't point up, but rather to the right
for 
> example).
>  >>> 
>  >>> Has anyone any idea of how to do this, or has done this?  My 
> company would be even willing to fund this effort if need be.
>  >>> 
>  >>> I'd love to hear anyone's thoughts on this.
>  >>  1. In Javascript/Images/DOM (ignoring Canvas for the moment),
there is
>  >>     no way to make an image exist on an angle.
>  >>  2. Canvas has some support for this, I believe
, but is limited in
where
>  >>     you can use it.
>  >>
>  >> pre-rotate your map (in a tool like photoshop, or something
equally non
>  >> OpenLayers related), and then work with at that point. Some people
on
>  >> the list have had some experience with that way of using
OpenLayers; a
>  >> key aspect of this would be to write a translation from your map 
> coordinates
>  >> (which will likely be in pixels after the rotation) to geogrpahic 
> coordinates,
>  >> but that's not too hard, in general.
>  >>
>  >> Best Regards,
>  >
>  > If you are using mapserver I believe there has been some work that
would
>  > allow the image to draw with north rotated say to the east. Look
for the
>  > ANGLE parameter in the MAP object.
> 
> In GeoServer land we're about to add the same parameter.
> However, once you rotate the map OL has to know and handle the
rotation
> otherwise panning and zooming go bye bye...
> 
> Cheers
> Andrea
> 
> --
> Andrea Aime
> OpenGeo - http://opengeo.org <http://opengeo.org/>
> Expert service straight from the developers.
> 

_______________________________________________
Dev mailing list
Dev at openlayers.org
http://openlayers.org/mailman/listinfo/dev




More information about the Dev mailing list