I am trying to write a new shapefile with fiona but after creating the features, i keep getting this output after the program crashes:
The program '[6668] python.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
I am using:
fiona==1.4.8', 'gdal==1.11.1','pyproj==1.9.3','shapely==1.4.4', 'six==1.8.0'
I tried re-installing gdal but that didnt help.
here is the piece of code that I am using:
from pyproj import Proj, transform
import fiona
import fiona.crs
from fiona.crs import from_epsg
import copy
shape = fiona.open("Sample.shp")
original = Proj(shape.crs) # EPSG:4326 in your case
destination = Proj('+proj=lcc +lat_1=36.41666666666666 +lat_2=35.25 +lat_0=34.33333333333334 +lon_0=-86 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83 +no_defs')
with fiona.open('new.shp', 'w', crs=from_epsg(4269), driver = 'ESRI Shapefile', schema = shape.schema.copy()) as output:
for feat in shape: # feat = one polygon of the shapefile
tempGeometry = feat['geometry']
out_linearRing = []
for point in feat['geometry']['coordinates'][0]: # LinearRing of the Polygon
long,lat = point # one point of the LinearRing
x,y = transform(original, destination,long,lat) # transform the point
out_linearRing.append((x,y)) # add all the points to the new LinearRing
# transform the resulting LinearRing to a Polygon and write it
feat['geometry']['coordinates'] = [out_linearRing]
output.write(feat)
dest_crsand after you usetransform(original, destination,long,lat)as in the original script Convert shapely polygon coordinates. So what isdestination? – gene Nov 11 '14 at 09:15dest_crsis a dictionary, not the same thing as Proj(init='EPSG:4326') (<pyproj.Proj object at 0x102a15e30>) – gene Nov 11 '14 at 09:23