[GRASS-user] Efficient vector spatial querying...

Dylan Beaudette dylan.beaudette at gmail.com
Wed Apr 9 17:49:28 EDT 2008


On Wednesday 09 April 2008, Jonathan Greenberg wrote:
> I have two datasets, both with about 1 million points per dataset (lets
> call them A and B).  I'd like to know, for each point in A, what the
> closest point in B is (e.g. a spatial join).  I can (and am) doing this
> with the brute force method that ArcMap seems to use (e.g. comparing
> each point to every other point, which is a 1,000,000^2 searches), but
> is there any way to do this more efficiently?  Would a postgis database
> (queried through GRASS) work better?  Does GRASS even have a gui for
> doing postgis queries?  Thanks!
>
> --j

I would use PostGIS for this task. You could use bounding boxes and a spatial 
index to reduce the search to only the local points. like this:

for each point:
select the minimum distance from
	(select the distance from all points to points of interest from
		(select points within 100 m from your point of interest)
	)



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


More information about the grass-user mailing list