From now, I have only this script, but it's seem I miss something because its doesn't have any raster output
a couple of things, i don't think your viewshed will run because you're not calling it (can't see the rest of the transformer settings). It should be on line 19 above self.pyout(), self.pyout should always be the last line in the input function because thats what creates a feature
At the moment, all line 24 is doing is storing the result against outViewshed. You then need to use arcpy to save the raster output to a file. Then, you can use fme to read the file back in. You can't pass an arcpy output directly to FME.
using feature.setAttribute('<name>','<value>') you can set the path youve output the raster to, then can read it back in using a featurereader. Make sure to expose the attribute you've created.
Have a look here:
https://community.safe.com/s/article/python-and-fme-basics
Thanks a lot for your answer. I'll work on it right now !
Hello again !
i've worked on my python script about to call a arcpy's tool in FME with its Python Caller.
I'm trying to import the LinearLineOfSight from Arcgis to FME.
To sum up, I have 2 shapefiles (observer and targets) and 1 raster (surface) in input and I need 4 shapefiles in output. I have wrote this code :
But I don't know what its need in addition to get it work.
If you have any idea or tips, it will be helpful ! :)
Hello again !
i've worked on my python script about to call a arcpy's tool in FME with its Python Caller.
I'm trying to import the LinearLineOfSight from Arcgis to FME.
To sum up, I have 2 shapefiles (observer and targets) and 1 raster (surface) in input and I need 4 shapefiles in output. I have wrote this code :
But I don't know what its need in addition to get it work.
If you have any idea or tips, it will be helpful ! :)
I'd have it all in the input function like below.
Make not that the inputs are being read from the feature (so you need to set them on the feature before the python caller), the output location is driven by the _pathname attribute, and four new attributes are being output that need to be exposed in the pythoncaller (out_los_feature_class,out_sight_line_feature_class,out_observer_feature_class,out_target_feature_class)
def input(self, feature):
#read these values off of the input feature
in_observer_features = feature.getAttribute("in_observer_features")
in_target_features = feature.getAttribute("in_target_features")
in_observer_features = feature.getAttribute("in_surface")
#use TempPathnameCreator before pythoncaller
outdir = feature.getAttribute("_pathname")
#create paths
out_los_feature_class = os.path.join(outdir,"out_los_feature_class")
out_sight_line_feature_class = os.path.join(outdir,"out_sight_line_feature_class")
out_observer_feature_class = os.path.join(outdir,"out_observer_feature_class")
out_target_feature_class = os.path.join(outdir,"out_target_feature_class")
#set paths on output feature
feature.setAttribute("out_los_feature_class",out_los_feature_class)
feature.setAttribute("out_sight_line_feature_class",out_sight_line_feature_class)
feature.setAttribute("out_observer_feature_class",out_observer_feature_class)
feature.setAttribute("out_target_feature_class",out_target_feature_class)
#Call arcpy
arcpy.LinearLineOfSight(in_observer_features,
in_target_features,
in_surface,
out_los_feature_class,
out_sight_line_feature_class,
out_observer_feature_class,
out_target_feature_class)
#output feature
self.pyoutput(feature)
I'd have it all in the input function like below.
Make not that the inputs are being read from the feature (so you need to set them on the feature before the python caller), the output location is driven by the _pathname attribute, and four new attributes are being output that need to be exposed in the pythoncaller (out_los_feature_class,out_sight_line_feature_class,out_observer_feature_class,out_target_feature_class)
def input(self, feature):
#read these values off of the input feature
in_observer_features = feature.getAttribute("in_observer_features")
in_target_features = feature.getAttribute("in_target_features")
in_observer_features = feature.getAttribute("in_surface")
#use TempPathnameCreator before pythoncaller
outdir = feature.getAttribute("_pathname")
#create paths
out_los_feature_class = os.path.join(outdir,"out_los_feature_class")
out_sight_line_feature_class = os.path.join(outdir,"out_sight_line_feature_class")
out_observer_feature_class = os.path.join(outdir,"out_observer_feature_class")
out_target_feature_class = os.path.join(outdir,"out_target_feature_class")
#set paths on output feature
feature.setAttribute("out_los_feature_class",out_los_feature_class)
feature.setAttribute("out_sight_line_feature_class",out_sight_line_feature_class)
feature.setAttribute("out_observer_feature_class",out_observer_feature_class)
feature.setAttribute("out_target_feature_class",out_target_feature_class)
#Call arcpy
arcpy.LinearLineOfSight(in_observer_features,
in_target_features,
in_surface,
out_los_feature_class,
out_sight_line_feature_class,
out_observer_feature_class,
out_target_feature_class)
#output feature
self.pyoutput(feature)
Hi,
I rewrote some parts of the scripts, adapted to my project and it works perfectly! thank you very much again!