Skip to content

Global Plant Visualization

October 8, 2015

Plants take root near the equator.

I’ve nailed down a good way to render height data and plant data with the same color. The ratio of the province height compared to tallest province is the main data value. Then the ratio of plants on the province compared to total possible plants on a province is used to step from the barren dirt color of that height ratio to a lush green color of that height ratio. This way the height data is displayed while a tinge of green represents plant density.

var plantDensity = numberPlants / totalPlantsPerProvince;
var heightRatio = worldContext.height[z] / worldContext.highest;

var heightColor = GetColorRatio(heightRatio, maxDirt, minDirt);
var plantColor = GetColorRatio(heightRatio, maxGreen, minGreen);

var difference = {
r: Math.round(plantDensity * (plantColor.r - heightColor.r)),
g: Math.round(plantDensity * (plantColor.g - heightColor.g)),
b: Math.round(plantDensity * (plantColor.b - heightColor.b))

ctx.fillStyle = rgb(
heightColor.r + difference.r,
heightColor.g + difference.g,
heightColor.b + difference.b);



Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: