[R-sig-Geo] RPyGeo Query -- probably easy
Maarten van Strien
maarten at vstrien.nl
Mon Dec 21 12:40:56 CET 2009
Thank you Alexander, your solution seems to work!
yes, the quotes are indeed tricky... The challenge is to provide the
correct mix of escaped and un-escaped single and double quotes to Python
/ ArcGIS as in this Python example:
' "ROAD_CLASS" = \'PAVED\' ')
In order to achieve this, the backslashes in \' have to be escaped
themselves, otherwise R will interpret them as escape symbols. After
all, \' ends up being coded as \\\' in R. Also, double double-quotes
have to be avoided; the quote.args argument of rpygeo.geoprocessor can
be used to suppress the outermost double quotes, single quotes can be
used explicitly instead: " ' sqlquery ' "
So here are two solutions:
env = rpygeo.build.env( workspace = "C:/TEMP",
overwriteoutput = TRUE )
list( "nfroads.shp", "paved.shp",
" ' \"ROAD_CLASS\" = \\\'PAVED\\\' ' "),
clean.up = FALSE, quote.args = c(T,T,F),
env = env)
env = env, clean.up = FALSE)
I hope this helps...
View this message in context: http://n2.nabble.com/RPyGeo-Query-probably-easy-tp2766675p4197371.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo