Question

Is there also a transform FME similar to the area solar radiation tool in arcgis?

  • 9 March 2021
  • 1 reply
  • 5 views

Badge

hello everyone

I want to ask a question. Is there also a transform FME similar to the area solar radiation tool in arcgis?

If so, can you tell me which one?

Since I couldn't find such a transform, I added the area solar radiation function in the Arcgis Model builder and exported it as a python script. So I wanted to create a new transform but I couldn't succeed.

can you help me with this

rsvp


1 reply

Userlevel 2
Badge +17

Hi @veyselakatay​ ,

 

FME does not have a dedicated tool to calculate the Solar Radiation. However, FME does have tools to help you calculate this in the workspace.

 

If you have ArcGIS on the same computer as FME, you can use arcpy  within a PythonCaller transformer to call the ArcGIS tool. The following example calls the CalculatePolygonMainAngle tool, but can be used as a starting point:

import fme
import fmeobjects
import arcpy
 
class PolygonMainAngleCalculator(object):
    def __init__(self):
        # create new feature class in scratch GDB
        result = arcpy.management.CreateFeatureclass(arcpy.env.scratchGDB, 'tririga_import_facilities_temp', 'POLYGON')
        self.feature_class = result[0]
        
        # set environment to scratch GDB
        arcpy.env.workspace = arcpy.env.scratchGDB
        
        # add id and angle fields to fc
        arcpy.AddField_management(self.feature_class, '_pmac_id', "LONG")
        arcpy.AddField_management(self.feature_class, '_poly_angle', "DOUBLE")
        
        # create insert cursor to add features to fc, setting geometry input to WKT
        self.cursor = arcpy.da.InsertCursor(self.feature_class, ['_pmac_id', 'SHAPE@WKT'])
        
        self.gotFeatures = 0
    
    def input(self,feature):
        # get geometry WKT from feature
        wkt = feature.getAttribute('_geometry')
        
        # get id from feature
        pmac_id = feature.getAttribute('_pmac_id')
        
        # create new fc geometry from id and wkt
        self.cursor.insertRow([pmac_id,wkt])
        
        # set rotation method from feature attribute
        self.rotMethod = feature.getAttribute('_Rot_Method')
        
        self.gotFeatures = 1
        
    def close(self):
        # set environment to scratch GDB
        arcpy.env.workspace = arcpy.env.scratchGDB
        
        # delete cursor
        del self.cursor
        
        if self.gotFeatures == 1:
        
            # run arcpy command to calculate polygon main angles, storing result in _poly_angle
            arcpy.CalculatePolygonMainAngle_cartography("tririga_import_facilities_temp", "_poly_angle", self.rotMethod)
            
            # create new cursor to read back fc features
            cursor = arcpy.da.SearchCursor('tririga_import_facilities_temp', ['_pmac_id','_poly_angle'])
            
            # for each row in fc, output no-geom feature with id and polygon angle
            for row in cursor:
                feature = fmeobjects.FMEFeature()
                feature.setAttribute('_pmac_id', row[0])
                feature.setAttribute('_poly_angle', row[1])
                self.pyoutput(feature)
            
            # delete cursor
            del cursor
 
        # delete fc
        arcpy.Delete_management('tririga_import_facilities_temp')

If you don't have ArcGIS available, you can the TINGenerator on your source data to generate triangles with slope and aspect information on them. You can use that location, elevation, slope and aspect information to calculate the solar radiation through the process described on the following page:

https://desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/how-solar-radiation-is-calculated.htm

 

 

 

Reply