Hi Zev,
the problems are definitely your quotes. First, they are syntactically
incorrect - I count seven double quotes (I recommend using some editor
with syntax highlighting, like Tinn-R or R-WinEdt, this helps discover
mismatches). Second, escaping them (\") should allow you to put double
quotes inside a double-quoted character string.
This might be closer to what you want to do (but I haven't tried to run
it - sorry, busy end of term...):
rpygeo.geoprocessor("makefeaturelayer('X:\\abc.shp','walk')",
"SelectLayerByAttribute('walk','NEW_SELECTION','\"hrwk05\"<>0')",
env=myenv)
Note that an additional argument clean.up=FALSE to the
rpygeo.geoprocessor allows you to inspect the Python file to check
whether the quotes are syntactically correct in Python.
I hope this helps
Alex
Zev Ross wrote:
Hi All,
I'm wondering if anybody could give me a little guidance on formatting a
query using RPyGeo. I'm excited to be able to run Python geoprocessing
functions straight from R but am having trouble with the quote, double
quote kinds of issues.
Here's an example of what I'd like to run
rpygeo.geoprocessor("makefeaturelayer('X:\\abc.shp',
'walk')", "SelectLayerByAttribute('walk','NEW_SELECTION', ' "hrwk05"
'<>0")",env=myenv)
Where the sticking point is hrwk05 <> 0. In Python my query would be
double quote, field name, close double quote, comparison, number e.g,
"hrwk05" <> 0 but I'm not sure how to put this into RPyGeo
If I run like so:
rpygeo.geoprocessor("makefeaturelayer('X:\\abc.shp',
'walk')", "SelectLayerByAttribute('walk','NEW_SELECTION', '')",env=myenv)
it runs.
Thank you in advance for assistance.
Zev
--
Alexander Brenning
brenn...@uwaterloo.ca - T +1-519-888-4567 ext 35783
Department of Geography and Environmental Management
University of Waterloo
200 University Ave. W - Waterloo, ON - Canada N2L 3G1
http://www.fes.uwaterloo.ca/geography/faculty/brenning/
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo