Hi I solve the problem by convert the nm/km to degree.
On Tue, Jan 29, 2013 at 4:48 PM, Grégory COLLIN <[email protected]> wrote: > I think the units is global. I don't think you can change that on the > fly, however, if we supposed you set up 'm' as units on your map, you > can set your radius size to 4000 to have 4KM. > > See the code below : > > var map = new OpenLayers.Map({ > div: "map", > theme: null, > units: 'm', > projection: "EPSG:900913", > }); > var thepoint = new > > OpenLayers.Geometry.Point(longitude,latitude).transform(this.projTo,this.projFrom); > var poly = new > OpenLayers.Geometry.Polygon.createRegularPolygon(thepoint,4000,6,0); > > This code sample is for drawing a polygon, since this is what i do. > However you will find easily how to draw a circle :) > > Hope it answer to your question ! > > > Le > Tue, 29 Jan 2013 09:18:02 +0100, 杨华杰 <[email protected]> a écrit : > > > eg. I want to draw a circle on the map, the radius is 4KM. > > > > > > On Tue, Jan 29, 2013 at 4:11 PM, 杨华杰 > > <[email protected]<mailto:[email protected]>> wrote: can set up it > > individual? This is a global setting. > > > > > > On Mon, Jan 28, 2013 at 6:45 PM, 杨华杰 > > <[email protected]<mailto:[email protected]>> wrote: nice, thank you > > very much, it help me a lot > > > > > > On Mon, Jan 28, 2013 at 4:38 PM, Grégory COLLIN > > <[email protected]<mailto:[email protected]>> wrote: Le Mon, 28 Jan 2013 > > 08:15:48 +0100, 杨华杰 <[email protected]<mailto:[email protected]>> 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. > > > > _______________________________________________ > > Users mailing list > > [email protected]<mailto:[email protected]> > > http://lists.osgeo.org/mailman/listinfo/openlayers-users > > > > > > > >
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
