Select to view content in your preferred language

Create a Buffer GP Service with multiple input geometry type (Point, Polygon, Polyline)

2197
11
Jump to solution
03-01-2024 07:59 AM
Labels (2)
Bertrand_Laurancin
Occasional Contributor

Hello,

I try to create from ArcGIS Pro a Buffer GP Service that accepts as input multiple geometry type (Point, Polygon, Polyline).

I tried this script :

 

import arcpy
arcpy.env.overwriteOutput = True
##arcpy.addOutputsToMap = True
if __name__ == "__main__":
    inputFc = arcpy.GetParameterAsText(0)
    outputFc = r"C:\temp\output_buffer.shp"
##    arcpy.AddMessage(inputFc)   
    # Create a Describe object from the feature class
    desc = arcpy.Describe(inputFc)
    # Print Sahpe Type
##    arcpy.AddMessage("Shape Type :   " + desc.shapeType)
    shpType = desc.shapeType
    if(shpType == "Polygon"):
        arcpy.AddMessage("Shape Type :   " + desc.shapeType)
        arcpy.analysis.Buffer(inputFc, outputFc, "500 meters")
    elif(shpType == "Point"):
        arcpy.analysis.Buffer(inputFc, outputFc, "500 meters")
    elif(shpType == "Polyline"):
        arcpy.analysis.Buffer(inputFc, outputFc, "500 meters") 

 

 

It works with ArcGIS Pro :

Bertrand_Laurancin_0-1709307815328.png

Bertrand_Laurancin_2-1709307859280.png

However, when I publish the result of the script (from ArcGIS pro) to a Web Tool (GP Service), the Geometry Type is always the same that the input geomtry used in ArcGIS Pro :

Bertrand_Laurancin_3-1709307988191.png

Therefore, in a WAB application, i can choose only a point feature layer as input :

Bertrand_Laurancin_4-1709308090366.png

 

I think it's not possible because "The geometry type comes from the input and output features that are used to create the result" | Source https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/share-analysis/web-tool-setting...

 

Is it really not possible ?

Is there a workaround ?

Do you have any idea ?

Thank you,

Bertrand

 

0 Kudos
11 Replies
Bertrand_Laurancin
Occasional Contributor

Hi @GeeteshSingh07,

You are right.

I created a model builder :

Bertrand_Laurancin_0-1709634757354.pngBertrand_Laurancin_1-1709634796590.png

It works in MapViewer :

Bertrand_Laurancin_2-1709634992999.png

However, in WAB it still not able to run against a different geometry type compared to the original geometry used to create the tool in ArcGIS Pro :

Bertrand_Laurancin_3-1709635096074.png

 

I found about a bug :

BUG-000161045 : When adding a geoprocessing service as a widget to ArcGIS Web AppBuilder, the tool does not honor the same geometry types as the geoprocessing tool

Thank you for your help,
Bertrand

GeeteshSingh07
Frequent Contributor

@Bertrand_Laurancin, thank you for sharing the bug details.

Have a good day!

--
Best Regards,
Geetesh
geetesh486@gmail.com
0 Kudos