Spatial binning with julia GeoStats packages

I have a bunch of spatially distributed event data. Each observation has a latitude, longitude coordinate, but no other attribute. I am looking at events happening in Ukraine, so the region is based upon national boundaries.

So I believe that in order to compute the variogram and krig the data, I have to apply some sort of bins to the data, and count the observations in each bin. I was wondering if there is a way to apply this kind of spatial binning using the GeoStats packages? I suppose something like that might be possible with the Meshes.jl package?

Once I compute the bins for the observations, I imagine that I would have to apply kriging on the new mesh.

I was hoping to find some code to help me at least do that binning piece. Not sure where to begin with that in Julia.

I think the keywords you need to look at are Kernel Density Estimates (or heatmaps). There are several implementations available for example or KDEstimation · Julia Packages

Since you are working with a domain with complicated boundaries you might be tempted by using within DIVAnd (DIVAnd_heatmap). GitHub - gher-ulg/DIVAnd.jl: DIVAnd performs an n-dimensional variational analysis of…


@JM_Beckers This is a very prescient suggestion. Yes, you are totally correct. I need to do some density estimation because I have points from some unknown density. haha in geostatistics they usually have some underlying surface and they sample to get the true spatial variation in the positive sections of the surface versus the negative sections–if I am sampling for ore or gold or something. But you are correct, in my case with battles, I only have positive samples and so everything will seem correlated–there is no variation.

I am familiar with KDE though I have not used it for spatial interpolation before. But there is a first time for everything right. I will have to check out this second package too, because you are correct about the
spatial constraints. I am familiar with variational methods–moreso with image processing applications–so that is what I was thinking about too–penalizing the density in infeasible regions or unlikely regions.

Do you know if there are any videos on the DIVAnd package or even on density estimation applied to spatial data? I checked out the DIVAnd repo and their are some links to a presentation. But videos are always nice if they are available.

Thanks so much for your help.

There is no video on density estimation with DIVAnd, but you can find some notebooks (look for heatmaps) in
which you need probably to adapt by excluding the path modification.
There are also other notebooks on classical DIVAnd use (

1 Like