I'm trying to use this field calculator expression on field Shape to generate a perpendicular line, of 0.01m, at the midpoint of each existing line feature in ArcGIS:
CALCULATE FIELD (data management): Input table: Clip_point_buffer Field name: Shape Expression: RotateExtend( !Shape!, 0.01) Expression type: Python Code 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)
(the code block i'm using comes from: https://gis.stackexchange.com/a/201871/63418)
It works if I do it with a shapefile, but if I have the same file as feature class in a database (.gbd) it doesn't. 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 and how can i do this process within a database. This is the error I get:
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?