[OpenLayers-Users] RegularPolygon radius document questions

杨华杰 yhjhoo at gmail.com
Tue Jan 29 20:21:51 PST 2013


Hi

I solve the problem by convert the nm/km to degree.


On Tue, Jan 29, 2013 at 4:48 PM, Grégory COLLIN <gcollin at v3d.fr> 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, 杨华杰 <yhjhoo at gmail.com> 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, 杨华杰
> > <yhjhoo at gmail.com<mailto:yhjhoo at gmail.com>> wrote: can set up it
> > individual? This is a global setting.
> >
> >
> > On Mon, Jan 28, 2013 at 6:45 PM, 杨华杰
> > <yhjhoo at gmail.com<mailto:yhjhoo at gmail.com>> wrote: nice, thank you
> > very much, it help me a lot
> >
> >
> > On Mon, Jan 28, 2013 at 4:38 PM, Grégory COLLIN
> > <gcollin at v3d.fr<mailto:gcollin at v3d.fr>> wrote: Le Mon, 28 Jan 2013
> > 08:15:48 +0100, 杨华杰 <yhjhoo at gmail.com<mailto: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.
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.osgeo.org<mailto:Users at lists.osgeo.org>
> > http://lists.osgeo.org/mailman/listinfo/openlayers-users
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130130/7f464a91/attachment.html>


More information about the Users mailing list