[GRASS-user] SQL query in Python script
Charlie Shobe
Charles.Shobe at Colorado.EDU
Sun Nov 30 11:21:37 PST 2014
Hi all,
I am attempting to extract a subset of points from a points vector based on
the values in the column "dir". I am running GRASS 6.4.4 on Mac OS 10.9.5.
In the GRASS command line, I can successfully make my selection with the
following command:
--------------------------------------------------------------
GRASS 6.4.4 (Yellowstone):~ > *v.extract input=streams_points
output=outlets_vect type=point where="dir<0"*
92 categories loaded from table <streams_points>
Extracting features...
Building topology for vector map <outlets_vect>...
Registering primitives...
92 primitives registered
92 vertices registered
Building areas...
100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
100%
Number of nodes: 92
Number of primitives: 92
Number of points: 92
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
Writing attributes...
v.extract complete.
-------------------------------------------------------
However, due to my incomplete knowledge of how Python and SQL interact, I
am having trouble executing the same command in a Python script. Here is
what I am trying:
*g.run_command("v.extract", input="streams_points", output="outlets_vect",
type="point", where="dir<0")*
When I run this command, it fails to extract any points. I know that this
must be due to some problem with the syntax of my SQL statement.
Can anyone clear this up for me?
Thanks,
Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20141130/1fe5439a/attachment-0001.html>
More information about the grass-user
mailing list