Fix bug with MultiPoint
This commit is contained in:
parent
0c1b41460c
commit
a9f20474b3
6
js/ds.js
6
js/ds.js
@ -248,11 +248,11 @@ DataSpace.getCenterCoordinates = function (geoJSON)
|
|||||||
|
|
||||||
let coordinates = geometry === 'Point' ?
|
let coordinates = geometry === 'Point' ?
|
||||||
geoJSON.features[0].geometry.coordinates :
|
geoJSON.features[0].geometry.coordinates :
|
||||||
geoJSON.features[0].geometry.coordinates[0];
|
geoJSON.features[0].geometry.coordinates[0];
|
||||||
|
|
||||||
let centerCoords = [coordinates[1], coordinates[0]];
|
let centerCoords = [coordinates[1], coordinates[0]];
|
||||||
|
|
||||||
if (geometry !== 'Point') {
|
if (! geometry.includes('Point')) {
|
||||||
let avX = coordinates[0]
|
let avX = coordinates[0]
|
||||||
.map(el => el[0])
|
.map(el => el[0])
|
||||||
.reduce((p, c) => p + c) / coordinates[0].length;
|
.reduce((p, c) => p + c) / coordinates[0].length;
|
||||||
|
Loading…
Reference in New Issue
Block a user