Hallo Colin Is it you that has this question at gis.stackexchange.com? http://gis.stackexchange.com/questions/6098/how-do-you-produce-a-output-table-containing-distances-between-mineral-grains-at
Or at least I saw some similarity in the questions. >From what you write here, if I understand you right? If you want to test polygonA, you want every polygon that gets some light from polygonA if it is PlygonA is shining. That might be quite complicated. /Nicklas On Wed, 2011-02-16 at 13:09 +0000, Colin wrote: > sorry for double post - working from dodgy pda > > Hi Steve / Brent > > Thanks for replies > > Steve: Yes I did look at buffer but I discounted it because a small > number of the polys are at distances well outside the mean and I didnt > see any easy way of including them. > Brents solution with st_distance and a tolerance factor might suffer > from the same problem > > And in fact the definition of adjacent doesnt include distance - its > simply that no other polygon crosses some path between any 2 > > I also have the centroids calced and stored so in my spatial innocence i > devised a solution which almost works and uses ST_Crosses(ST_MakeLine > something like this: > > select a.id, b.id, ST_Crosses(ST_MakeLine(a.centroid, b.centroid), > b.geom) as stcrosses > from a, b where a.id = nnn and a.id!=b.id order by stcrosses > > I run this per id from program code. I then filter the return to give > adjacents > > I'm not at my dev machine right now and I suspect thats not exacty > right(at all!) but what I have isnt affected by distance and almost > works - except occasionally for the very complex and where there are > larger gaps between polys. > > so maybe a combination of these methods? > > Or since the data wont change often, maybe I just plot them in qgis and > do it manually! ;-) > > Colin > > > On 02/16/2011 05:12 AM, Stephen Woodbridge wrote: > > Colin, > > > > Did you look at buffer? > > > > Not tested but something like this might work where b.id are the > > adjacent id's to a.id with the distance of <tolerance>. > > > > select a.id, b.id from mypolys a, mypolys b > > where a.id != b.id > > and buffer(a.geom, <tolerance>) && b.geom > > and intersects(buffer(a.geom, <tolerance>), b.geom) > > > > -Steve > > > > On 2/15/2011 5:38 PM, Colin wrote: > >> Hi > >> > >> I'm quite new to postgis and spatial databases. > >> competent with sql and db's > >> > >> My problem: How to locate adjacent polygons. > >> > >> I have around around 2k irregular polygons. > >> They've have been calculated as alpha / concave hulls from point sets. > >> They're saved into pg as multipolygons > >> > >> id | description | geom > >> > >> The polygons dont have any regularity with regard to location and > >> interaction > >> the majority are close to a neighbour, but not touching. Typically > >> within +/- 1 - 5% of polygon max dim > >> a small number slightly overlap 1 or more neighbours, usually to quite a > >> small extent > >> their irregular shape can include 'undercuts' > >> > >> > >> I need to identify the adjacent neighbours for each polygon > >> > >> I looked at various methods that might allow me to do this but I cant > >> get a 100% solution > >> > >> Can anyone suggest methods that might work > >> > >> thanks > >> > >> > >> Colin > > _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
