lazaare wrote:
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):
in_observer_features = feature.getAttribute("in_observer_features")
in_target_features = feature.getAttribute("in_target_features")
in_observer_features = feature.getAttribute("in_surface")
outdir = feature.getAttribute("_pathname")
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")
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)
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)
self.pyoutput(feature)