<div dir="ltr">Hi <div><br></div><div style>I solve the problem by convert the nm/km to degree.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 29, 2013 at 4:48 PM, Grégory COLLIN <span dir="ltr"><<a href="mailto:gcollin@v3d.fr" target="_blank">gcollin@v3d.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think the units is global. I don't think you can change that on the<br>
fly, however, if we supposed you set up 'm' as units on your map, you<br>
can set your radius size to 4000 to have 4KM.<br>
<br>
See the code below :<br>
<div class="im"><br>
var map = new OpenLayers.Map({<br>
div: "map",<br>
theme: null,<br>
units: 'm',<br>
projection: "EPSG:900913",<br>
</div> });<br>
var thepoint = new<br>
OpenLayers.Geometry.Point(longitude,latitude).transform(this.projTo,this.projFrom);<br>
var poly = new<br>
OpenLayers.Geometry.Polygon.createRegularPolygon(thepoint,4000,6,0);<br>
<br>
This code sample is for drawing a polygon, since this is what i do.<br>
However you will find easily how to draw a circle :)<br>
<br>
Hope it answer to your question !<br>
<br>
<br>
Le<br>
Tue, 29 Jan 2013 09:18:02 +0100, 杨华杰 <<a href="mailto:yhjhoo@gmail.com">yhjhoo@gmail.com</a>> a écrit :<br>
<div class="im"><br>
> eg. I want to draw a circle on the map, the radius is 4KM.<br>
><br>
><br>
> On Tue, Jan 29, 2013 at 4:11 PM, 杨华杰<br>
</div>> <<a href="mailto:yhjhoo@gmail.com">yhjhoo@gmail.com</a><mailto:<a href="mailto:yhjhoo@gmail.com">yhjhoo@gmail.com</a>>> wrote: can set up it<br>
<div class="im">> individual? This is a global setting.<br>
><br>
><br>
> On Mon, Jan 28, 2013 at 6:45 PM, 杨华杰<br>
</div>> <<a href="mailto:yhjhoo@gmail.com">yhjhoo@gmail.com</a><mailto:<a href="mailto:yhjhoo@gmail.com">yhjhoo@gmail.com</a>>> wrote: nice, thank you<br>
<div class="im">> very much, it help me a lot<br>
><br>
><br>
> On Mon, Jan 28, 2013 at 4:38 PM, Grégory COLLIN<br>
</div>> <<a href="mailto:gcollin@v3d.fr">gcollin@v3d.fr</a><mailto:<a href="mailto:gcollin@v3d.fr">gcollin@v3d.fr</a>>> wrote: Le Mon, 28 Jan 2013<br>
> 08:15:48 +0100, 杨华杰 <<a href="mailto:yhjhoo@gmail.com">yhjhoo@gmail.com</a><mailto:<a href="mailto:yhjhoo@gmail.com">yhjhoo@gmail.com</a>>> a<br>
<div><div class="h5">> écrit :<br>
><br>
> > Hi<br>
> ><br>
> > I have a question about the document.<br>
> ><br>
> > Here is the URL:<br>
> > <a href="http://dev.openlayers.org/docs/files/OpenLayers/Handler/RegularPolygon-js.html#OpenLayers.Handler.RegularPolygon.setOptions" target="_blank">http://dev.openlayers.org/docs/files/OpenLayers/Handler/RegularPolygon-js.html#OpenLayers.Handler.RegularPolygon.setOptions</a><br>
> ><br>
> ><br>
> ><br>
> > The<br>
> > radius<<a href="http://dev.openlayers.org/docs/files/OpenLayers/Handler/RegularPolygon-js.html#OpenLayers.Handler.RegularPolygon.radius" target="_blank">http://dev.openlayers.org/docs/files/OpenLayers/Handler/RegularPolygon-js.html#OpenLayers.Handler.RegularPolygon.radius</a>><br>
> > explain as {Float} Optional radius in map units of the regular<br>
> > polygon.<br>
> ><br>
> ><br>
> > What's the unit? kilometer/meter/mile/NM?<br>
> ><br>
> ><br>
> > Regards,<br>
> > Hua Jie<br>
><br>
> Hi Hua Jie,<br>
><br>
> The units requested could be defined in the map object.<br>
><br>
> So here is the code sample i used :<br>
><br>
> var map = new OpenLayers.Map({<br>
> div: "map",<br>
> theme: null,<br>
> units: 'm',<br>
> projection: "EPSG:900913",<br>
> controls: [<br>
> new OpenLayers.Control.Navigation({zoomWheelEnabled: false}),<br>
> new OpenLayers.Control.NavToolbar({zoomWheelEnabled: false}),<br>
> new OpenLayers.Control.PanZoomBar(),<br>
> new OpenLayers.Control.ScaleLine()]<br>
> });<br>
><br>
><br>
> So you can add the unit you want in this constructor.<br>
> according to the documentation :<br>
> <a href="http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.units" target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.units</a><br>
><br>
> you can specify : ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’,<br>
> ‘inches’.<br>
><br>
> Enjoy,<br>
><br>
> Best regards.<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
</div></div>> <a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><mailto:<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
><br>
><br>
><br>
<br>
</blockquote></div><br></div>