AnsweredAssumed Answered

Strange arcpy polyline geometry behavior. (mixins._passthrough object)

Question asked by GIS_Adrian on Dec 12, 2018
Latest reply on Mar 16, 2019 by Dan_Patterson

Hello guys,

is there someone who were annoyed by this kind of problem?

So, first of all I want you to notice that the feature class Roads has a POLYLINE geometry type, and there are no multipart features in it.

import arcpy

for i in arcpy.da.SearchCursor(r'C:\Users\...\Administrative_area.gdb\Roads', ["SHAPE@"]):
    print(i[0])

Normally, the output for this code will be something like this:

And it works.

 

 

Now the problem appears when I put this little piece of code in the main script:

    def get_near_data(self):
        with arcpy.da.SearchCursor(r'C:\Users\...\Administrative_area.gdb\Roads', ["SHAPE@"]) as reader:
            for f in reader:
                print(f[0])

And the output is not the same as in the first case. This is not geometry.

 

I've noticed that if I change the path for feature class Roads to another feature class which has a polygon geometry type, it works just fine again, take a look:

    def get_near_data(self):

        with arcpy.da.SearchCursor(r"C:\Users\...\ArcGIS\Administrative_area.gdb\CountyBoundary", ["SHAPE@"]) as reader:
            for f in reader:
                print(f[0])

And the output is going to be like this:

 

So, what is going on here? Why geometries of polyline feature classes aren't returned while geometries of polygons are?

Outcomes