简体   繁体   中英

Google Maps Api Changing a polygon to a circle

I have some code with points which draws a polygon.

Here is the code:

  app.pts = [
    [33.644631, -70.610453],
    [33.637884, -70.608253],
    [33.637566, -70.608704],
    [33.638933, -70.610935],
    [33.641044, -70.614036],
    [33.641386, -70.614176]
 ];

 app.map = L.map('map').setView(app.pt, 15);


 app.polygon = L.polygon(app.pts, {
    color: '#00ff00',
    opacity: 0.6,
    fillOpacity: 0.2
 });

What I would like is a circle instead, so my question is:

How do I modify this code so I can draw a Circle instead of a polygon?

The circle would be 50 meters radius and centered on 33.644631, -70.610453

根据文档

app.circle = L.circle([33.644631, -70.610453], {radius: 50});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM