AnsweredAssumed Answered

Calculating perpendicular line only works for shapefiles not for feature class

Question asked by adri77 on Feb 13, 2018
Latest reply on Feb 13, 2018 by xander_bakker

In ArcGIS I'm trying to use this field calculator expression on field Shape to generate a perpendicular line, of 0.01m length, at the midpoint of each existing line feature:

CALCULATE FIELD (data management):Input table: Clip_point_bufferField name: ShapeExpression: RotateExtend( !Shape!, 0.01)Expression type: PythonCode Block:  Pre logic script code:def RotateExtend(plyP,sLength):l=plyP.length ptX=plyP.positionAlongLine (l/2).firstPoint ptX0=plyP.firstPoint ptX1=plyP.lastPoint dX=float(ptX1.X)-float(ptX0.X)dY=float(ptX1.Y)-float(ptX0.Y)lenV=math.sqrt(dX*dX+dY*dY)sX=-dY*sLength/lenV;sY=dX*sLength/lenV leftP=arcpy.Point(ptX.X+sX,ptX.Y+sY)rightP=arcpy.Point(ptX.X-sX, ptX.Y-sY)array = arcpy.Array([leftP,rightP])section=arcpy.Polyline(array)return section Shape:RotateExtend( !Shape!, 0.01)

 

It works if I do it with a shapefile, but it doesn't work if I try to do it in this same shapefile imported as a feature class in a database (.gbd). The database has a tolerance 0.001 and the default resolution (0.0001). Why the process does not work when the feature is in a database?

I've read that it might have something to do with the properties of "Shape" type of field, because it's locked when in a database. If that's the error, how could I obtain the same results working with a feature class in a database?

Outcomes