SpatialDataFrame has been deprecated

304
12
Jump to solution
03-31-2020 05:32 AM
Highlighted
New Contributor III

I receive following warning after this statement is run: sdf = features.SpatialDataframe(df)

opt/anaconda3/lib/python3.7/site-packages/arcgis/features/_data/geodataset/geodataframe.py:221: UserWarning: SpatialDataFrame has been deprecated.  Please switch to the GeoAccessor/GeoSeriesAccessor.   warnings.warn("SpatialDataFrame has been deprecated.  Please switch to the GeoAccessor/GeoSeriesAccessor.")

What is the correct way to create an 'sdf' now?

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Regular Contributor

Hi art zaifman,

The answer to your question might be found here: Introduction to the Spatially Enabled DataFrame | ArcGIS for Developers 

New at version 1.5, the Spatially Enabled DataFrame is an evolution of the SpatialDataFrame object that you may be familiar with. While the SDF object is still avialable for use, the team has stopped active development of it and is promoting the use of this new Spatially Enabled DataFrame pattern. The SEDF provides you better memory management, ability to handle larger datasets and is the pattern that Pandas advocates as the path forward.

HTH,

Egge-Jan

View solution in original post

12 Replies
Highlighted
MVP Regular Contributor

Hi art zaifman,

The answer to your question might be found here: Introduction to the Spatially Enabled DataFrame | ArcGIS for Developers 

New at version 1.5, the Spatially Enabled DataFrame is an evolution of the SpatialDataFrame object that you may be familiar with. While the SDF object is still avialable for use, the team has stopped active development of it and is promoting the use of this new Spatially Enabled DataFrame pattern. The SEDF provides you better memory management, ability to handle larger datasets and is the pattern that Pandas advocates as the path forward.

HTH,

Egge-Jan

View solution in original post

Highlighted
New Contributor III

It does help and thank you for the rapid reply, Egge-Jan!

Short follow-up question:  is there a description of the method in which GIS().content.import_data(panda data frame containing lat, lon columns) populates the SHAPE column?  Main question is why are the 'x, y' values in the SHAPE column so different from the original 'latitude, longitude' values

Reply
0 Kudos
Highlighted
MVP Regular Contributor

Hi art zaifman,

Always happy to help 🙂 If you consider your initial question being answered you might consider to 'close the call' by marking my answer as correct.

Regarding your follow-up question: I guess this has something to do with the use of different coordinate systems being used. It looks like your input latitude and longitude are in WGS84 (EPSG:4326) whereas the coordinates in the SHAPE column are - most probably - in EPSG:3857.  (EPSG:3857 is a Spherical Mercator projection coordinate system popularized by web services such as Google and later OpenStreetMap, and also being used by Esri, with WKID:102100).

I guess the points do appear in the right location when plotted on the map, don't they?

BR,

Egge-Jan

Highlighted
New Contributor III

The points are mapped correctly and thank you again!

Reply
0 Kudos
Highlighted
New Contributor III

from pyproj import Proj, transform

print(transform(Proj('epsg:4326'), Proj('epsg:3857'), 45.810, -122.691))  # longitude first, latitude second.

(-13657899.64491753, 5749953.689939638)
Highlighted
New Contributor III

BTW, here's an excellent reference for how to code bulk transformations using pyproj:  High-performance bulk transformation of coordinates

Highlighted
New Contributor III

Are these UTM coordinates?

Thanks.

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

webby stuff is usually in a Web Mercator projection

Highlighted
MVP Regular Contributor

... so that would be this WKID:102100/EPSG:3857 thing, as I mentioned above.

Reply
0 Kudos