[OpenLayers-Users] RegularPolygon radius document questions
Grégory COLLIN
gcollin at v3d.fr
Mon Jan 28 00:38:34 PST 2013
Le Mon, 28 Jan 2013 08:15:48 +0100,
杨华杰 <yhjhoo at gmail.com> a écrit :
> Hi
>
> I have a question about the document.
>
> Here is the URL:
> http://dev.openlayers.org/docs/files/OpenLayers/Handler/RegularPolygon-js.html#OpenLayers.Handler.RegularPolygon.setOptions
>
>
>
> The
> radius<http://dev.openlayers.org/docs/files/OpenLayers/Handler/RegularPolygon-js.html#OpenLayers.Handler.RegularPolygon.radius>
> explain as {Float} Optional radius in map units of the regular
> polygon.
>
>
> What's the unit? kilometer/meter/mile/NM?
>
>
> Regards,
> Hua Jie
Hi Hua Jie,
The units requested could be defined in the map object.
So here is the code sample i used :
var map = new OpenLayers.Map({
div: "map",
theme: null,
units: 'm',
projection: "EPSG:900913",
controls: [
new OpenLayers.Control.Navigation({zoomWheelEnabled: false}),
new OpenLayers.Control.NavToolbar({zoomWheelEnabled: false}),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.ScaleLine()]
});
So you can add the unit you want in this constructor.
according to the documentation :
http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.units
you can specify : ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’.
Enjoy,
Best regards.
More information about the Users
mailing list