# How to cluster points based on a kernel density?

I have a large dataset with 36k points representing commercial land uses, each with a field containing the square footage. I have run a kernel density analysis on this dataset, producing a raster showing the density of commercial square footage over the entire metro area. I need to divide this raster into regions corresponding to local maxima, which I call a "center". I have already determined the locations of the centers, and now I need to do one of two things:

• use a point clustering tool, such as "partitioning around medoids", to group the points into clusters around the centers I've identified. The problem with this method is that it is computationally intense, and even more so if I try to use a dissimilarity matrix to weight the points by size.

• somehow divide the kernel density raster (which roughly resembles a terrain raster) into individual "hills" around each center. But I can't think of any tool for doing this.

This problem has plagued me for a while, and I hoped that I'd be able to perform the clustering method in R, but it is time consuming and I'm running out of time. Does anyone know of a simple method for either dividing density rasters into neighborhoods of intensity or for quickly clustering large datasets?

Discussion following a closely related post revealed a simple, effective solution: to find the "hills", turn the grid upside-down (by negating its values) and find watersheds. The hills are sinks and watershed boundaries partition the grid into those sinks.

• This solution is simple, quick, and exactly what I was looking for. Thanks. – Patrick Aug 10 '11 at 15:27

The simplest answer would be to use a threshold to mask out areas that fall below the threshold. This should give you distinct areas surrounding your centres. Then it should be able to convert those areas into shapes.

You may also find Spatial statistics tools : clustering analysis on raster data a useful discussion of a similar problem.

• Yes, that is a very relevant discussion! I am reading through your MSc thesis and will try out some of the methods. – Patrick Aug 9 '11 at 14:12
• Using a threshold probably won't work here, as I am trying to distinguish centers from other centers immediately adjacent. In the city core, the boundary between the two will have a very high density, but in the suburban fringe, it will have a very low density. But I am hoping that using the second derivative will be effective. – Patrick Aug 9 '11 at 14:15

I think you should go back to your initial problem: Find clusters of commercial square footage in an entire metro region.

I assume your points are centroids of parcels with values of square footage commercial? I assume you can also have a polygon layer of parcels with total square footage for each parcel? That gives you a case set (the centroids) and a population (the parcel polygons) for square footage commercial and square footage respectively.

Go grab SatScan http://www.satscan.org/ and run a space only Poisson-distributed model and you will have your commercial square footage clusters in pretty quick order. (You can also use square footage of land as your population too rather than square footage of building space. That might even be the better population.)

• You are right that the points are centroids, but unfortunately the dataset was compiled by others from each county's parcel layer and only distributed as points. But SatScan looks like a very useful piece of software, so I will keep t in mind for other applications. – Patrick Aug 9 '11 at 13:15