problem of using arcpy.polyline creat line

302
3
06-28-2019 08:21 PM
lmzh
by
New Contributor
I  have a python script that was get coordinate points (Longitudinal and latitudinal coordinate ) from excel and writing them to an arcpy.Array and then writing the array to an already existing feature class as a polyline.  but line created  finished offset the point ,and vertices of  creating line  less than numbers of points. 

0 Kudos
3 Replies
JoshuaBixby
MVP Esteemed Contributor

You appear to be using the original ArcPy cursors, as opposed to the ArcPy Data Access cursors that were introduced in 10.1.  I recommend switching to the DA cursors and then re-post your question if you are still having issues:  Accessing data using cursors—Help | ArcGIS Desktop 

0 Kudos
LukeWebb
Occasional Contributor III

I always make my polylines like this, so no idea if this will help:

polyline=arcpy.Polyline(array)

row.setValue(shapename, polyline)

For the offset, you probably need to include a spatial reference:

spatref_epsg = 4326   #https://spatialreference.org/ref/epsg/wgs-84/

arcpy.CreateFeatureclass_management(out_path=folder, out_name=shapename,geometry_type='POLYLINE', spatial_reference=arcpy.SpatialReference(spatref_epsg))

lmzh
by
New Contributor

thanks, offset reason is lack of spatial reference indeed.

0 Kudos