Friday, 9 December 2016

carto - Ordering Cartodb torque visualization over Google Maps heatmap layer


I am attempting to create a map with two layers: a CartoDB Torque visualization on top and a Google heatmap layer underneath. So far I have only been able to get them to draw in the opposite order I'm going for. I have tried calling a setTimeout on cartodb.createLayer and reordering when the layers are created. Can this ordering be done via either the Google Maps API or CartoDB? Below is the relevant code.


heatmapData = [lots of new google.maps.LatLng()]


var heatmap = new google.maps.visualization.HeatmapLayer({
data: heatmapData,
opacity: 0.5,
gradient: g,
radius: 12
});

heatmap.setMap(map);

cartodb.createLayer(map, 'http://catalina.cartodb.com/api/v2/viz/2ed4ec6e-5f84-11e4-ab03-0e853d047bba/viz.json')

.addTo(map, 0)
.on('done', function(layer) {
//do nothing
})
.on('error', function(err) {
alert("some error occurred: " + err);
});

Full code available on http://catalinagis.org/bison2




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...