4

I'm trying to create a "heatmap" style visualization from a number of geopoints and values associated with them. I have been following along with this blog post.

I've got a CSV file of points like the following:

POINT_Y,POINT_X,Value
-41.157785,174.8343481,5
-41.1575385,174.8347111,4
-41.1574106,174.8347659,9
-41.1572644,174.8348964,2
-41.1570742,174.8351378,7
-41.1569067,174.835225,1

I've converted them into a GeoTIFF file with interpolation using gdal_grid. This was the command I ran:

gdal_grid -a invdist:power=3.0:smoothing=1.0:radius1=90000:radius2=90000:max_points=0 -a_srs WGS84 -of GTiff -ot Float64 -l test test.vrt test.tiff 

That seems to work and generates a GeoTIFF file that looks right (I can paste the gdalinfo output, in case that helps)

I'm wondering how I style the points to get something similar to what is shown at the bottom of that blog post? I'm using TileMill to style my maps, and when I add the GeoTIFF to my project as a layer I get a white box that's in the correct place:

white box in the correct place

But of course I can't see any of the individual points on the grid. I'm fairly sure I'm missing an important step to colourize the points, I'm just not sure what it is!

I don't have any Carto styles applied to the layer in TileMill.

Thanks in advance!

Nik

2 Answers 2

2

I've had some success using the gdaldem command. Something like the following:

gdaldem color-relief test.tiff ramp.txt test-color-relief.tiff -alpha

Where ramp.txt is a file like the following:

0% 255 255 255 0
20% 255 247 236 255
30% 254 232 200 255
40% 253 212 158 255 
50% 253 187 132 255
60% 252 141 089 255
70% 239 101 072 255
80% 215 048 031 255
90% 179 000 000 255
100% 127 000 000 255

Those are values/percentages for each of the "stops", then rgba colours.

Basically the gdal_grid command from the blog post is converting the values I'm using to z values for each point (i.e elevation) and then I'm using the command to create elevation maps in order to colourize the GeoTIFF.

I still can't get it to look ideal, but I think that's more down to more tweaking required on the gdal_grid parameters than anything else.

1

The documentation mentions a Raster Symbolizer but lacks an example.

Supposedly

TileMill has a built-in reference containing all of the Carto options. Click on the book icon at the top-right of the TileMill editor.

(Source)

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.