1

I'm using PostgreSQL/PostGIS and I have an advanced type of query.

My database contains two types of object - let's say pubs and churches :)

Is there a way that I can find the area with the densest concentration of pubs compared to churches, and vice versa?

I can obviously display this visually with a heatmap, but I just wondered if there was a programmatic way to do this with PostgreSQL? Perhaps the point that is closest to the most churches relative to pubs?

Thanks.

Antonio Falciano
  • 14,333
  • 2
  • 36
  • 66
flossfan
  • 11
  • 1
  • Welcome to GIS.SE. Just to clarify, "...find the area with...": do you actually already have a layer of area boundaries? If so, it should be fairly easy to make the query. If not, hmm, ... i think you're looking at some kind of nearest-neighbor analysis. – Martin F Jan 06 '14 at 08:52
  • Thanks! I don't currently have a set of areas, but I can add one easily enough. However, I'd like an analysis that takes into account the distance between different areas (otherwise I don't really need a spatial database at all, I can just run a normal database query...). – flossfan Jan 06 '14 at 09:38
  • How about clustering(http://gis.stackexchange.com/a/11778/16594)? It does let you find the areas with high density. – Jakub Kania Jan 06 '14 at 12:29
  • Hm, actually I'm not sure clustering is going to work for my data. Say I look at pubs: if I simply look for clusters among pubs, it's going to find the biggest cluster in the capital city, where there are also the most churches. It's relative density I'm interested in, and I don't think clustering can correct for this. Or am I wrong? – flossfan Jan 07 '14 at 10:49
  • Well, if you want relative density then you need something to relate to. Like a grid or city borders. – Jakub Kania Jan 08 '14 at 13:54

0 Answers0