I got the following GeoDataFrame taken from a CSV file and after some slincing and CRS and geometry asignment

    ctf_nom         geometry                                    id      
0   Prunus mahaleb  POINT (429125.795043319 4579664.7564311)    2616    
1   Betula pendula  POINT (425079.292045901 4585098.09043407)   940     
2   Betula pendula  POINT (425088.115045896 4585093.66943407)   940     
3   Abelia triflora POINT (429116.661043325 4579685.93743111)   2002    
4   Abies alba      POINT (428219.962044021 4587346.66843531)   797  

I've converted the geometry from a str trough:

from shapely import wkt

df['geometry'] = df['geometry'].apply(wkt.loads)
df_geo = gpd.GeoDataFrame(df, geometry = 'geometry')

and asigned a crs by :

df_geo.crs = {'init' :'epsg:25831'}

when I'm trying to save again the reduced geodataframe by gdf.to_file() function it returns the following attribute error:

out = r'my_path\df_geo.geojson'
df_geo.to_file(out, driver = 'GeoJSON')

It's even the same when I try with shp extension...

AttributeError: 'Series' object has no attribute 'has_z'

How can I solve this?

  • Can you show the code that gives the error? – Dataform Jul 4 at 8:57
  • Sure, I've edited the question for your request – Rodrigo Vargas Jul 4 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.