What is the difference between geoaccessor and geoseriesaccessor?

665
3
12-06-2021 09:26 AM
TylerT
by
Occasional Contributor III

What is the difference between geoaccessor and geoseriesaccessor, and how can I access geoseriesaccessor?  

I have the following snippet of code:

 

df.spatial.as_arcpy()

 

returns the error:

AttributeError: 'GeoAccessor' object has no attribute 'as_arcpy'

 as_arcpy is a method of GeoSeriesAccessor, not GeoAccessor, so how do I specify GeoSeriesAccessor?

Thank you,

Tyler

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor
0 Kudos
TylerT
by
Occasional Contributor III

Well, I cleared up a major blind spot that's helps me.  GeoAccessor uses spatial namespace while GeoSeriesAccessor uses geom namespace.  Unless I missed it in the docs, this is not completely obvious.  That's why I was getting the attribute error above.  

Tyler

CSDFRADMIN
New Contributor II

This is a very important input! I was aware that GeoAccessor used the spatial namespace, since one can find a lot of examples online. But for the GeoSeriesAccessor I couldn't find the namespace, which is why the documentation led me to believe, that the methods are applied directly on a geometry object. So I started using it in pandas .apply() method. This works for smaller dataframes, but soon leads to runtime errors (more specifically to the recursion error "maximum recursion depth exceeded"). The error would drive me crazy and had me waste almost a whole day.

It is really hard to find the correct namespace online. I would appreciate if the documenation of the API could be more specific for the use of the GeoAccessor and GeoSeriesAccessor.

0 Kudos