Skip to content
Prev 5489 / 29559 Next

RPyGeo Query -- probably easy

Hi Alex,

Thank you so much for the suggestion and apologies for taking so long to 
test it. I think the quotes are still a problem. I do indeed write all 
my code in R-WinEdt but must be doing something wrong. In Python your 
suggested escaped quotes works fine but perhaps I missed something in 
RPyGeo:

This code works in Python:

gp.makefeaturelayer("abc.shp", "walk")
gp.SelectLayerByAttribute('walk','NEW_SELECTION','\"hrwk05\" <> 0')

This code works in R:

rpygeo.geoprocessor(
"makefeaturelayer('abc.shp', 'walk')",
"SelectLayerByAttribute('walk','NEW_SELECTION','')",
env=myenv)

This code gives me an error in R:

rpygeo.geoprocessor(
"makefeaturelayer('abc.shp','walk')",
"SelectLayerByAttribute('walk','NEW_SELECTION','\"hrwk05\" <> 0')",
 env=myenv)

File "x:\projects\rpygeo.py", line 10
gp.makefeaturelayer('abc.shp','walk')( 
"SelectLayerByAttribute('walk','NEW_SELECTION','"hrwk05" <> 0')" )
                                                                                                 
^
SyntaxError: invalid syntax
NULL

(note from Zev -- the carrot occurs under the "05")
Alexander Brenning wrote: