3

I am trying to use the Rcaller in FME to perform zonal statistics.

input: shapefile and a Geotiff

I read that the Rcaller reads the input data as a dataframe when it is imported into the Rcaller (R). So, I tried to convert the dataframes back to a shapefile (sp::SpatialPointsDataFrame) and a raster (raster::rasterFromXYZ).

However, I get an error,

X and Y coordinates are missing

I cannot figure out how I could add the X & Y coordinates to the input dataframe, and I am wondering if it is even possible to use a shapefile and raster as input for the Rcaller?

Or does anybody else knows a better way to perform zonal statistics in FME?


Update:

I also got an answer from Safe:

You can't load a raster/image directly into the RCaller data frame. You have >to read your raster directly in your R script. It would be similar to writing a >raster, as illustrated in this kriging example. Alternatively, you could covert >your raster to points using RasterCellCoercer / RasterToPointCoercer, but this >could be pretty slow depending on the size of your raster

link: https://knowledge.safe.com/questions/78108/perform-zonal-statics-with-the-rcaller.html

  • 2
    This probably won't help unless you have access to ArcGIS spatial analyst installed on the same computer as FME. But I've used a pythoncaller transformer to run some arcpy code to run zonal statistics in the past. – Fezter Sep 10 '18 at 23:50
  • @pzman can you please answer your question. (with your update). – Mapperz Sep 12 '18 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.