Skip to content

Instantly share code, notes, and snippets.

View jinlong's full-sized avatar

涂鸦码龙 jinlong

View GitHub Profile
@jeremejazz
jeremejazz / polygonCenter.js
Last active February 22, 2021 21:19
Return Center polygon in google maps v3. This does not apply to some shapes though. I recommend using turf.js instead https://turfjs.org/
function polygonCenter(poly) {
var lowx,
highx,
lowy,
highy,
lats = [],
lngs = [],
vertices = poly.getPath();
for(var i=0; i<vertices.length; i++) {