hi,
after reading a feather file as described here
# Create SeDf by reading from feather
sdf_f = pd.DataFrame.spatial.from_feather(
'./sedf_data/cities/sample_cms_data.feather')
we get a pandas DF.
calling
print(sdf_t.spatial.sr)
gives: {'wkid': None}
How could one (re)project the sdf?
You can directly set the sr property of the spatial dataframe.
from arcgis import GeoAccessor
from arcgis.geometry import SpatialReference
# Create dataframe by reading from feather
df = GeoAccessor.from_feather(
'./sedf_data/cities/sample_cms_data.feather')
# Create spatially enabled dataframe (NAD27, EPSG 4267)
sdf_f = GeoAccessor.from_df(df, sr=4267, geometry_column='SHAPE')
# Directly set the spatial reference (WGS84, EPSG 4326) with no conversion
sdf_f.spatial.sr = SpatialReference(4326)
# Verify the spatial reference
print(sdf_f.spatial.sr)
Note, this is different projecting the dataframe from one spatial reference system to another. In that case, you would use the .project() method to ensure proper conversion.
# Inplace projection to NAD27
sdf_f.spatial.project(4267)