[GRASS-user] SQL Queries

Brent Wood b.wood at niwa.co.nz
Thu Jul 27 20:15:06 EDT 2006


Slover, Kevin wrote:
>
> Ok, looking for a SQL guru out there…
>
> Want to see if something is even possible or not using GRASS (using 5.4)
>
> Here is the situation… I have 2 files, once containing xyz pts, and 
> another containing polygons. I am wondering if there is a way to use a 
> sql query to find the average elevation for a given polygon?
>
> I am trying right now to use MapInfo to do this query, but it doesn’t 
> like the amount of points I am query (> 1,500,000) and knowing that 
> GRASS is much better at processing and dealing with larger files, 
> wondered if a query like this is possible..
>
> Any ideas??
>
If you really want to do this in SQL you could use PostGIS. I have done 
similar operations on tables with between a few hundred and >200,000,000 
records, and have had no real problems. I have found that a monolithic 
spatial join as you require can be slow, but it can usually be broken 
down into separate queries, each dealing with a subset of the data, 
running sequentially via a script, and the reponse is orders of 
magnitude faster.

If this option is of interest, let me know & I can go through how I have 
done 9& optimised) such things...


Cheers

Brent Wood




More information about the grass-user mailing list