POST
|
I want to split a polygon into strips with equal width but I got stuck by the Parcel editing idea: arcgis 10.0 - How to split a polygon into multiple equal-width polygons in ArcMap 10? - Geographic Information Systems S… I can't open Parcel Division to edit feature class so I must convert the feature class into Parcel fabric. But I am not sure how to do this. Can anyone point out a right way?
... View more
10-14-2016
09:31 PM
|
0
|
3
|
2048
|
POST
|
Would that relate to the environment the input features are in? For example, if the file is under a folder instead of a Geodatabase.
... View more
10-13-2016
02:54 PM
|
0
|
1
|
811
|
POST
|
I am also using ArcGIS 10.4. OK then this is weird ... ... I think commenting is the same as deleting it. So this line is not required? in_feature.filter.list = ['Polygon', 'Polyline', 'Points']
... View more
10-12-2016
06:29 PM
|
0
|
3
|
811
|
POST
|
Thanks Randy, it works when I commented out line 27 but I still don't understand why. Can you please explain a little more?
... View more
10-12-2016
04:23 PM
|
0
|
5
|
811
|
POST
|
Thanks, I don't have the example data they use for tutorial so I just use mine. I tried the codes on another data but it still doesn't read polygon. I tried `datatype = 'GPFeatureLayer'` but it still doesn't work.
... View more
10-12-2016
04:18 PM
|
0
|
0
|
811
|
POST
|
Yes, this is what they use as an example for ESRI online learning tutorial. You are right and there is a lot of extra lines in define parameter and validation that may not be necessary. I generally use exiting tools for map automation but no idea how to develop my own tools. Anyway, I still couldn't find what it is wrong. I've thought it would be somewhere during validation. But I have compared the codes very carefully and it seems to be the same as the tutorial.
... View more
10-10-2016
07:56 PM
|
0
|
2
|
811
|
POST
|
Thanks, how is this relate to question? Are the codes work normal on your side?
... View more
10-06-2016
07:20 PM
|
1
|
11
|
858
|
POST
|
It only finds 'Street' as Input Feature and no other polygons. I don't understand why. Line 37 ... ... name = 'field_name'?
... View more
10-05-2016
07:06 PM
|
0
|
0
|
858
|
POST
|
Please find my last edited reply. The previous screen shot was the one that's working.
... View more
10-05-2016
02:35 PM
|
0
|
1
|
547
|
POST
|
I use 'polygon to raster' conversion to convert my files into raster. So it is in GRID.
... View more
10-04-2016
08:02 PM
|
0
|
3
|
547
|
POST
|
What confuses me is that the points and the raster are in the same coordinate system 'NZGD2000'. But 'extract multi values' tool runs ok when the raster is in a folder.
... View more
10-04-2016
07:49 PM
|
0
|
5
|
547
|
POST
|
Sorry I am not sure if this is the correct answer. I do it again today but it turns out the same issue. 'fnet_label' has the same coordinate system as my raster. Here are screen shots: Extract values to points works fine though ... ...
... View more
10-04-2016
06:11 PM
|
0
|
7
|
1060
|
POST
|
Yes, I did. I manually indented the ones with 'if-else' statement.
... View more
10-04-2016
03:33 PM
|
0
|
2
|
858
|
POST
|
I'm following an ESRI online learning tutorial: Creating Python Toolboxes Using ArcGIS 10.1. I copy the script and test on my data but the new tool only recognises 'Street' as an input feature. Can anyone tell me where is wrong with the codes below? import arcpy
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Calculate Geometry"
self.alias = "geometry"
# List of tool classes associated with this toolbox
self.tools = [CalculateGeometry]
class CalculateGeometry(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "CalculateGeometry"
self.description = ""
self.canRunInBackground = True
def getParameterInfo(self):
# first parameter
"""Define parameter definitions"""
in_features = arcpy.Parameter(
displayName = 'Input Feature',
name = 'in_features',
datatype = 'Feature Layer',
parameterType = 'Required',
direction = 'Input')
in_features.filter.list = ['Point','Polyline','Polygon']
# second parameter
field = arcpy.Parameter(
displayName = 'Field name',
name = 'field_name',
datatype = 'Field',
parameterType = 'Required',
direction = 'Input')
field.parameterDependencies = [in_features.name]
# only show field belongs to the input feature
in_features.filter.list = ['Short','Long','Double','Float','Text']
# third parameter
geomProperty = arcpy.Parameter(
displayName = 'Property',
name = 'geomProperty',
datatype = 'String',
parameterType = 'Required',
direction = 'Input')
# fourth parameter
units = arcpy.Parameter(
displayName = 'Units',
name = 'units',
datatype = 'String',
parameterType = 'optional',
direction = 'Input',
enabled = False)
# fifth parameter
out_features = arcpy.Parameter(
displayName = 'Output Features',
name = 'out_features',
datatype = 'Feature Layer',
parameterType = 'Derived',
direction = 'Output')
field.parameterDependencies = [in_features.name]
out_features.schema.clone = True
params = [in_features, field, geomProperty, units, out_features]
return params
def isLicensed(self):
"""Set whether tool is licensed to execute."""
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."""
# Get Inputs
in_features = parameters[0]
geomProperty = parameters[2]
units = parameters[3]
# Geometry Property Filter Lists
pointPropertyList = ['X Coordinate of Point',
'Y Coordinate of Point']
linePropertyList = ['Length', 'X Coordinate of Line Start',
'Y Coordinate of Line Start',
'X Coordinate of Line End',
'Y Coordinate of Line End']
polygonPropertyList = ['Area','Perimeter',
'X Coordinate of Centroid',
'Y Coordinate of Centroid']
# Get shape type of input to determine
# filter list for geometry property parameter
if in_features.value:
desc = arcpy.Describe(in_features.valueAsText)
if desc.shapeType == 'Point':
geomProperty.filter.list = pointPropertyList
elif desc.shapeType == 'Polyline':
geomProperty.filter.list = linePropertyList
elif desc.shapeType == 'Polygon':
geomProperty.filter.list = polygonPropertyList
# Unit Filter Lists
areaUnitList = ['Acres','Ares','Hectares','Square Centimeters','Square Inches','Square Feet','Square Kilometers','Square Meters','Square Miles','Square Millimeters','Square Yard','Square Decimeters']
lengthUnitList = ['Centimeters','Feet','Inches','Kilometers','Meters','Miles','Millimeters','Nautical Miles','Yards','Decimal Degrees']
# Get geometry property input to determine filter list for unit parameter
if geomProperty.value:
if geomProperty.valueAsText == 'Area':
units.enabled = True
units.filter.list = areaUnitList
elif geomProperty.valueAsText in ['Length','Perimeter']:
units.enabled =True
units.filter.list = lengthUnitList
else:
units.value = ''
units.filter.list = []
units.enabled = False
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
in_features = parameters[0]
geomProperty= parameters[2]
units = parameters[3]
# Check is input is Multipoint or Multipatch and if so set an error
if in_features.value:
desc = arcpy.Describe(in_features.valueAsText)
if desc.shapeType in ['Multipoint','Multipatch']:
in_features.setErrorMessage('{0} features are not supported.'.format(desc.shapeType))
# Check if certain geometry property value is set with no units and add error
if geomProperty.valueAsText in ['Length','Perimeter','Area']:
if not units.value:
units.setErrorMessage('Units required for {0} property'.format(geomProperty.valueAsText))
return
def execute(self, parameters, messages):
"""The source code of the tool."""
# Get Input
in_features = parameters[0].valueAsText
field = parameters[1].valueAsText
geomProperty= parameters[2].valueAsText
units = parameters[3].valueAsText
shapeFieldName = arcpy.Describe(in_features).shapeFieldName
# Create the expression
exp = '!' + shapeFieldName
if geomProperty == 'Area':
exp += '.area@'+ units.replace('','')
elif geomProperty in ['Length','Perimeter']:
exp += '.length@'+ units.replace('','')
else:
propertyList = geomProperty.split('')
coord = propertyList[0]
if propertyList[-1] in ['Point','Start']:
exp += '.firstPoint.' + coord
elif propertyList[-1] == 'End':
exp += '.lastPoint.'+ coord
elif propertyList[-1] == 'Centroid':
exp += '.centroid.'+ coord
exp+= '!'
messages.addMessage(
'\nExpression used for field calculation: {0}\n'.format(exp))
#Calculate Field
arcpy.CalculateField_management(in_features,field,exp,'PYTHON_9.3')
return
... View more
10-03-2016
08:33 PM
|
0
|
20
|
3194
|
Title | Kudos | Posted |
---|---|---|
1 | 10-06-2016 07:20 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|