|
|
|
@ -25,14 +25,15 @@ const globalMap = { |
|
|
|
map: null |
|
|
|
map: null |
|
|
|
} |
|
|
|
} |
|
|
|
const formatArea = function(polygon) { |
|
|
|
const formatArea = function(polygon) { |
|
|
|
const area = getArea(polygon, { |
|
|
|
let area = getArea(polygon, { |
|
|
|
projection: 'EPSG:4326' |
|
|
|
projection: 'EPSG:4326' |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
area = area * 0.0015 |
|
|
|
let output; |
|
|
|
let output; |
|
|
|
if (area > 10000) { |
|
|
|
if (area > 10000) { |
|
|
|
output = Math.round((area / 1000000) * 100) / 100 + ' ' + 'k㎡'; |
|
|
|
output = Math.round((area / 10000) * 100) / 100 + ' ' + '万亩'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
output = Math.round(area * 100) / 100 + ' ' + '㎡'; |
|
|
|
output = Math.round(area * 100) / 100 + ' ' + '亩'; |
|
|
|
} |
|
|
|
} |
|
|
|
return output; |
|
|
|
return output; |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -125,6 +126,7 @@ const startMeasure = (map, callback) => { |
|
|
|
const vector = new VectorLayer({ |
|
|
|
const vector = new VectorLayer({ |
|
|
|
id: 'draw-layer', |
|
|
|
id: 'draw-layer', |
|
|
|
source: source, |
|
|
|
source: source, |
|
|
|
|
|
|
|
zIndex: 9999, |
|
|
|
style: feature => { |
|
|
|
style: feature => { |
|
|
|
return generateStyle(feature, { |
|
|
|
return generateStyle(feature, { |
|
|
|
fillOpt: { |
|
|
|
fillOpt: { |
|
|
|
|