1

I want to rotate my map in openlayers. When I set an "angle" as an url option in geoserver openlayers preview, the map is rotated, but I can't seem to find the correct place in my openlayers html-file.

http://docs.geoserver.org/latest/en/user/services/wms/vendor.html

3
  • 1
    Found the answer. I have to set the parameter in three sections: - untiled = new OpenLayers.Layer.WMS( - tiled = new OpenLayers.Layer.WMS( - map.events.register('click', map, function (e) { Commented Jun 20, 2013 at 8:16
  • Welcome to GIS Stack Exchange! Thankyou for getting back to the community so quickly to let us know your problem has been resolved. In such cases I, and most likely others, will vote to close the question as being too localized (in time) so please do not be offended to see that happen.
    – PolyGeo
    Commented Jun 20, 2013 at 8:19
  • I think that this question has some value, and hence I have expanded its scope, to server a general reference for Vendor Parameters. Commented Jun 20, 2013 at 8:48

2 Answers 2

2

These vendor parameters need to be sent to geoserver from OpenLayers. hence the parameter needs to be put in the options of the constructor of your layer.

So the simple way of constructing our layer is like this:

var wms = new OpenLayers.Layer.WMS("My Layer",
                                   "http://example.com/geoserver/wms",
                                   {layers: "states"});

To pass on vendor parameters to the server, you'll need to do this:

var wms = new OpenLayers.Layer.WMS("My Layer",
                                   "http://example.com/geoserver/wms",
                                   {
                                    layers: "states",
                                    transparent: true, //standard WMS parameter
                                    angle: 45, //vendor specific parameter
                                    buffer:5 //vendor specific parameter
                                   });

These vendor specific parameters will be appended to the WMS requests that OpenLayers makes, and hence Geoserver will respond with an appropriate response.

0

WMS vender parameter means you can append the parameter to the WMS url directly, just like normal WMS parameters. And in OpnLayers you have the mergeNewParams function.


layer.mergeNewParams({
    'angle': angle_value
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.