Q&A - Question Heatmap generation Question Danv asked on September 15, 2016, keyword: Developer Kernel I am working on the few lines in TatukGIS DK11 to generate a heatmap. This my code: procedure TForm1.btnGenHeatmapClick(Sender: TObject); var l_layer : TGIS_LayerVector; l_heatmap : TGIS_GaussianHeatmap; l_pixel : TGIS_LayerGRD; l_ok : boolean; begin GISHEAT.SetCSByEPSG(4362); l_pixel := TGIS_LayerGRD(GISHEAT.Get('Heatmap')); if not Assigned(l_pixel) then begin l_pixel := TGIS_LayerGRD.Create; l_pixel.Name := 'Heatmap'; l_pixel.SetCSByEPSG(4362); GISHEAT.Add(l_pixel); end; l_layer := TGIS_LayerVector(GISHEAT.Get('gis.osm.pois_free_1')); if not Assigned(l_layer) then exit; l_heatmap := TGIS_GaussianHeatmap.Create; l_heatmap.Radius := 10; l_ok := l_heatmap.Import(l_layer, GISHEAT.VisibleExtent, 'fclass', l_pixel, ,GISHEAT.VisibleExtent); ShowMessage(BoolToStr(l_ok)); GISHEAT.Update; end; However I do not get a heatmap and the message always shows me a 0. What do I miss? Answers Danv replied September 14, 2016 I see I have to add l_pixel.Path but then the next complains pops up: The file does not exist. I thought it wass easy but seems to be tricky. Adam Siwecki replied September 15, 2016 You miss the pixel (grid) layer initialization - you just created an object but it has no resolution, no extent, no file etc. Instead of: l_pixel := TGIS_LayerGRD.Create; l_pixel.Name := 'Heatmap'; l_pixel.SetCSByEPSG(4362); it should be: l_pixel := TGIS_LayerGRD.Create; l_pixel.Build( path, TGIS_CSFactory.ByEPSG(4326), l_layer.Extent, width, height ) ; l_pixel.Name := 'Heatmap'; l_pixel.Open ; However, if you want the heatmap/grid layer to be temporary don't use TGIS_LayerGRD but a generic TGIS_LayerPixel instead. Also, for the best results use the same CS for the pixel layer as for the source layer. The code should look like the follownig: l_pixel := TGIS_LayerPixel.Create; l_pixel.Build( True, l_layer.CS, l_layer.Extent, width, height ) ; l_pixel.Name := 'Heatmap'; l_pixel.Open ; Also, remember that the Radius (gaussian 3-sigma) is in map units so '10' might not give you a result that makes any sense. A good choice of Radius is a value close to the average distance between the sample points. The calculation of a reasonable Radius will be atomated in the future. If you would like to answer the question please Sign In. * * Stay signed in on this computer Please review our recent Privacy Policy.If you have any questions or requests, please contact us. Forgotten password Rules The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers. Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone. Keep the content positive and professional. Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved. The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.