![]() ![]() I don't have experience coding but i modified one of the esri resources examples and it worked for me. I am using ArcGIS 10.1 with ArcInfo license. Are their any expressions I can add to this code to calculate the X and Y coordinates of the start and end points of the polyline? This code only calculates the coordinate at the centre of the shape I believe. ![]() YExpression = "float(!SHAPE.CENTROID!.split())"Īrcpy.CalculateField_management("Polyline", "startx", 圎xpression, "PYTHON")Īrcpy.CalculateField_management("Polyline", "starty", yExpression, "PYTHON") I have the following code I've found that might be able to perform the desired task with some modification: 圎xpression = "float(!SHAPE.CENTROID!.split())" I can perform this task by right-clicking the attribute and calculating geometry, but I want to automate this process for about 30 polylines. I have added the 4 fields (startx, starty, endx, endy) in Python with the following code: Arcpy.addfield_management ("Polyline","startx","DOUBLE") The examples below use SearchCursor to print the coordinates for all features.I have a series of polyline shapefiles and I am trying to automate the process of calculating the X and Y coordinates of the line start and line end using Python. Provides a portable representation of a geometry value as a double of the feature's double of the feature's length. Provides a portable representation of a geometry value as aĬontiguous stream of well-known text (WKT) representation for OGC geometry. This returns the same value as double of the feature's double of the feature's double of the feature's double of the feature's Esri JSON string representing the well-known binary (WKB) representation for OGC geometry. For instance, returns a tuple of x,y coordinates that represent the feature's geometry object for the tuple of the feature's centroid x,y tuple of the feature's centroid x,y coordinates. If you only need specific properties of the geometry, use tokens to provide shortcuts to access geometry properties. Accessing the full geometry is more time-consuming. Additional geometry tokens can be used to access specific geometry information. Geometry tokens can also be used as shortcuts in place of accessing full geometry objects. Learn more about writing geometries Using geometry tokens A clockwise ring is an exterior ring, and a counterclockwise ring defines an interior ring. A valid ring consists of a valid path, such that the from and to points of the ring have the same x,y coordinates. Although composed of many islands, it would be recorded in the database as one feature.Ī ring is a closed path that defines a two-dimensional area. For example, in a layer of states, the state of Hawaii could be considered a multipart feature. Whenever a script is reading coordinates for polygons in a geodatabase or shapefile, it should contain logic for handling inner rings if this information is required by the script otherwise, only the exterior ring is read.Ī multipart feature is composed of more than one physical part but only references one set of attributes in the database. The exterior ring is always returned first, followed by inner rings, with null point objects as the separator between rings. The array of point objects returned for a polygon contains the points for the exterior ring and all inner rings. If a polygon contains holes, it consists of a number of rings. ![]() All other feature types-polygon, polyline, and multipoint-return an array of point objects, or if the feature has multiple parts, an array containing multiple arrays of point objects. PointGeometry features return a single Point object instead of an array of point objects. If an index is not specified, an array containing an array of point objects for each geometry part is returned. The getPart method returns an array of point objects for a particular part of the geometry if an index is specified. The geometry object's partCount property returns the number of parts for a feature. These points can be accessed with geometry objects ( Polygon, Polyline, PointGeometry, or MultiPoint), which returns them in an array of Point objects.įeatures can have multiple parts. Each feature in a feature class contains a set of points defining the vertices of a polygon or line, or a single coordinate defining a point feature. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |