Hi Guys,
I ma looking for JavaScript sample to split/cur polyline in ArcGis JavaScript API.
I found one sample but it did not work for me.
I tried to do something using Geometry but failed.
If you have some code share Please.
Thank you.
Hi Guys, need a time, start working on Python Add-in, when finish i will share Code.
Sorry, not sure how to help. It would be helpful to share your JavaScript code, JS API version, and any Console error messages.
I would create a geo - processing(python) tool like erase on the server and host it.
Once hosted I will call the tool in my javascript code.
Here is the python tool box code:
import arcpyfrom arcpy import envenv.workspace=sys.path[0]+"/test.gdb"env.overwriteOutput=True
class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" self.label = "Toolbox" self.alias = ""
# List of tool classes associated with this toolbox self.tools = [_Erase]
class Model_Erase(object): def __init__(self): """Define the tool (tool name is the name of the class).""" self.label = "_Erase" self.description = "" self.canRunInBackground = False
def getParameterInfo(self): # Input Features parameter Input_Feature_Line = arcpy.Parameter( displayName="Input Feature", name="Input_Feature_Line", datatype="DEFeatureClass", parameterType="Required", direction="Input") Input_Feature_Line.filter.list = ["Point","Polyline","Polygon"]
Input_Erase_Layer = arcpy.Parameter( displayName="Erase Feature", name="Input_Erase_Layer", datatype="DEFeatureClass", parameterType="Required", direction="Input") Input_Erase_Layer.filter.list = ["Point","Polyline","Polygon"]
Output_Feature_Layer = arcpy.Parameter( displayName="Intersect Output", name="Intersect_Layer", datatype="GPFeaturelayer", parameterType="Derived", direction="Output")
parameters = [Input_Feature_Line, Input_Erase_Layer,Output_Feature_Layer] return parameters
def isLicensed(self): """Set whether tool is licensed to execute.""" arcpy.CheckOutExtension("Spatial") return True
def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" return
def updateMessages(self, parameters): """Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.""" return
def execute(self, parameters, messages): """The source code of the tool.""" Input_Feature_Line = parameters[0].valueAsText Input_Erase_Layer = parameters[1].valueAsText if Input_Feature_Line == '#' or not Input_Feature_Line: Input_Feature_Line = sys.path[0]+"/test.gdb/polygon_area_buffer_1" # provide a default value if unspecified
if Input_Erase_Layer == '#' or not Input_Erase_Layer: Input_Erase_Layer = sys.path[0]+"/test.gdb/Deployment" # provide a default value if unspecified
# Local variables: #out_feature_class="%SCRATCHWORKSPACE%\\Erase_output.shp" out_feature_class="in_memory/out_feature_class" cluster_tolerance = "#" # Process: Erase arcpy.Erase_analysis(Input_Feature_Line, Input_Erase_Layer, out_feature_class, cluster_tolerance) parameters[2].value = out_feature_class print "DONE" return
Could you explain a bit more about what you are trying to accomplish, and post the code that you tried? Also, which version of the JS API are you using?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.