Skip to main content

I have a workspace that accepts both a raster input and a point vector input. I want to get the value of the raster at every single point. I know that the vector features will always be provided in WGS84 latlongs, but the raster might be any arbitrary coordinate system.

 

The simplest solution is to reproject the raster to WGS84. However, raster reprojection is very expensive compared to reprojecting a few hundred points. I want to be able to temporarily reproject the points to whatever CRS the raster is in. What is the best approach to this in FME?

 

So far I have been able to use the coordinate system extractor to set the crs as an attribute on the raster feature, but I'm struggling to get this single attribute from the single feature to use to set the reprojector input.

 

Things I have tried unsuccessfully:

  • Python scripted parameter (can't find a python API class that can load the raster and look at the CRS)
  • Set a parameter within the workspace at runtime (apparently the parameters cannot be changed once the transformation has started)
  • use the VariableSetter and VariableRetriever (keeps telling me that the two transformers are not associated with each other)
  • Use a geometry remover to drop the raster geometry, then feed the single feature into a featurejoiner/merger to add the CRS as an attribute to all the point features.

 

This seems like a really basic task and I'm really stuck on how to approach this. Any advice?

 

Thanks,

Max

Alrighty, already an update:

 

I finally solved it, by using the VariableSetter/VariableRetriever combo! The problem before was because I was not rerunning the entire workspace. It might be good to have an easier/more readable way to implement this very common task, but at least I have something working for now.


Reply