I need to create to create 2 function to return max and min Z/elevation/altitude values from LineString GeoJSON file.
i have created 2 function to get that before, but i was using MultiLineString GeoJSON file, but now i am using LineString.
this one of the 2 function:
function minHPoint(arr, multi) {
var min = Infinity, len, tmpArr, minPoint;
if (multi) {
multiLen = arr.length;
}
else {
tmpArr = arr;
multiLen = 0;
};
while (multiLen--) {
if (multiLen >= 0) tmpArr = arr[multiLen];
len = tmpArr.length;
while (len--) {
if (tmpArr[len][2] < min) {
min = tmpArr[len][2];
minPoint = tmpArr[len];
}
}
}
return minPoint;
};
var coords = layer.feature.geometry.coordinates;
var minPoint = minHPoint(coords, (layer.feature.geometry.type == 'MultiLineString'));
minH = minPoint[2];
$('#Low-Point').html("Low point: "+Math.round(minH)+" Meters");
No comments:
Post a Comment