Created
March 15, 2019 00:04
-
-
Save harllos/81ebc0770a3d7fe9f35d9769b084c2f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFeatureDomain(geojson_data, myproperty) { | |
let data_domain = [] | |
turf.propEach(geojson_data, function(currentProperties, featureIndex) { | |
data_domain.push(Math.round(Number(currentProperties[myproperty]) * 100 / 100)) | |
}) | |
return data_domain | |
} | |
function createColorStops(stops_domain, scale) { | |
let stops = [] | |
stops_domain.forEach(function(d) { | |
stops.push([d, scale(d).hex()]) | |
}); | |
return stops | |
} | |
function createRadiusStops(stops_domain, min_radius, max_radius) { | |
let stops = [] | |
let stops_len = stops_domain.length | |
let count = 1 | |
stops_domain.forEach(function(d) { | |
stops.push([d, min_radius + (count / stops_len * (max_radius - min_radius))]) | |
count += 1 | |
}); | |
return stops | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment