Hi all,
I am very knew to this R and Arcgis combination. I have already spent days
attempting to find my answer but have failed, therefore could you please if
possible explain any answers in simple form.
I am trying to access Arcgis through R, following a few steps:
1) Set up working directory
2)connect to Python
3) import arcgis- however, when I get to the import stage it comes up with
an error saying unexpected symbol.
Is my coding wrong? If so what is the correct coding?
Or do I somehow need to set up something in Arcgis which allows it to
recognise the arcgisscripting command in R?
*This is the code I have used below:*
My.dir<- setwd("C:/RTest_NDVIc")
require(rgdal)
nat <- readGDAL("16-150406_ndvic.img")
# Write the raster as a geotiff
# Give an output name
My.ras.dir <- paste(My.dir,"my_test_raster3.tif")
# Write
#writeRaster(nat,paste(My.ras.dir))
####E
####S Part 2 do some analysis in ArcGIS-first connect to Python
###S Require necessary package
require(RPyGeo)
###S Configure python
# If you don't configure python, you won't be able to send info to
ArcGIS
# This configuration will go on the ArcGIS function we create
workspace.<- setwd("C:/RTest_NDVIc")
python.path.<-"C:/Python25" # Check if this is correct for your
system
env.cur <- rpygeo.build.env(
workspace = workspace.,#ARC related
python.path = python.path.,
python.command = "python.exe", #python related
overwriteoutput=1 #if 1, overwrite
)
# Working directory
work.dir<-workspace.
# Import system modules
import arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
Thank you, any help is much appreciated.
--
View this message in context:
http://r.789695.n4.nabble.com/Arcgis-in-R-tp4636718.html
Sent from the R help mailing list archive at Nabble.com.