[GRASS-user] Filtering or querying data?
Moritz Lennert
mlennert at club.worldonline.be
Tue Dec 11 01:49:02 PST 2012
On 09/12/12 19:09, Aren Cambre wrote:
> I have a PostGIS dataset with just over 2 million rows. Each row has a
> PostGIS geometry point value and several attributes.
>
> I'd like to do some analysis on certain subsets of the data, but I can't
> figure this out. All I can find is how to import the data anew from
> Postgres, after I've used Postgres to filter or query the data.
>
> Is there a way of querying data once you have it in GRASS GIS?
> Alternately, is it possible to leave the attribute data back in
> Postgres, and then do queries or filters based on this data?
Using db.connect / v.db.connect you can define the table a vector map is
connected to. Postgres is one possible backend, so you can connect GRASS
vector maps to Postgres tables (or views).
>
> For example, suppose that my 2+ million rows had a boolean column *X*.
> How would I run GRASS analysis on the entire dataset, then immediately
> do the same analysis on only the data where this column is set to *false*?
Many vector modules have a 'where' option which allows you to define an
SQL-style where clause (without the where key word) to limit the data
based on attributes. However, coverage is not complete across modules [1].
Or you can use v.extract to create a new vector layer.
Moritz
[1] http://trac.osgeo.org/grass/ticket/1798
More information about the grass-user
mailing list