Finding the center of Leaflet polygon?

后端 未结 4 548
逝去的感伤
逝去的感伤 2020-12-24 13:00

I have a bunch of leaflet polygons on a map I created. Each polygon represents something different. A specific set of information is displayed in a popup depending on the pa

4条回答
  •  孤城傲影
    2020-12-24 13:41

    Since some time Leaflet has built-in getCenter() method:

    polygon.getBounds().getCenter();
    

提交回复
热议问题