'geopandas shape files coordinates
I'm currently trying to create geojson files from a set of shape files.
for shape_file in shape_files[1:]:
print(fileName(shape_file))
shp = geopandas.read_file(shape_file)
shp.to_crs(epsg = '4326')
file_name = shape_file[0:len(shape_file) - len('.shp')] + '.geojson'
print(file_name)
print('Adding to JSON file')
shp.to_file(file_name, driver = 'GeoJSON')
print(fileName(file_name) + ' JSON file created.')
print()
print('DONE')
One of the problems is that the coordinates are not in the format I would like to use.
To combat this I've altered the code to edit the coordinate system but I'm now getting this error.
RuntimeError: b'no arguments in initialization list'
Any suggestions?
Solution 1:[1]
The dtype to put the epsg in is incorrect. If you declare epsg it must be int. So your code should look like this:
shp.to_crs(epsg = 4326)
or
shp.to_crs('epsg:4326')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Urban87 |
