I'm trying to create a shapefile of points from a coordinate list. But, when I use fiona to create the shapefile Arc Catalog is showing that there is no CRS. I tried to add the CRS with Geopandas and got the same result. I have my code below with file paths removed but it works with the files I use.

# import
import os
from PIL import Image, ExifTags
import geopandas as gpd
import fiona
from fiona.crs import from_epsg
from shapely.geometry import Point
from shapely.geometry import mapping
import shapely
from collections import defaultdict
# define functions
def dms_to_dd(d, m, s):
    dd = d + float(m)/60 + float(s)/3600
    return dd
pathforresult = r"Result.shp"
NCDict = {}
WCDict = {}
# opening files and extracting exif
Path = r"final project pics"
filelist = os.listdir(Path)
for f in filelist:
    if f.endswith(".jpg"):
        with open(Path + "/" + f, 'r') as I:
            img = Image.open(Path + "/" + f)
            exif = {ExifTags.TAGS[k]: v for k, v in img._getexif().items() if k in ExifTags.TAGS}
            meta = exif['GPSInfo'][2]
            meta = [x[0] for x in meta]
            d = meta[0]
            m = meta[1]
            s = meta[2]
            NCDict[os.path.basename(I.name)] = dms_to_dd(d=d,m=m,s=s)
            # Ncoords = {I:dms_to_dd(d=d, m=m, s=s)}
            # print(Ncoords)
            meta2 = exif['GPSInfo'][4]
            meta2 = [b[0] for b in meta2]
            d = meta2[0]
            m = meta2[1]
            s = meta2[2]
            WCDict[os.path.basename(I.name)] = dms_to_dd(d=d,m=m,s=s)
print("North Coordinate List " + str(NCDict))
print("West Coordinate List: " + str(WCDict))

# writing xy coords to new file
corddict = [NCDict, WCDict]
dd = defaultdict(list)

for d in (NCDict, WCDict):  # you can list as many input dicts as you want here
    for key, value in d.items():


schema = {'geometry': 'Point', 'properties': {'name': 'str:10'}}
# create and save the resulting shapefile
with fiona.open(pathforresult, 'w', crs=from_epsg(4326), driver='ESRI Shapefile', schema=schema) as output:
    for key, value in dd.items():
        point = Point(value[0],value[1])
        prop = prop = {'name': key}
        output.write({'geometry': mapping(point), 'properties': prop})
result = gpd.read_file(pathforresult)
result.crs = {'init': 'epsg:4326'}
result.to_file(r"Result2.shp", driver="ESRI Shapefile", schema=schema)
  • 1
    Hi, can you try to simplify the example and make it reproducible? For example, I suppose the image reading for loop to create the coords is not actually needed, and you can also use some random values to show the issue?
    – joris
    Commented May 8, 2019 at 13:51

2 Answers 2


You use one of the solutions proposed in Using dictionary of file names and DD coordinates to create points in shapefile using shapely? and the CRS is saved in the result.prj file

enter image description here

With the GeoPandas or Fiona solution, the CRS in the prj file is:


I don't know or use ArcGIS-Arc Catalog but the ESRI wkt is the same


And this prj file works in Prj2EPSG for example

enter image description here


enter image description here


@gene explained in a bit more detail how this works but the real issue is that I was not saving the correct shapefile in my result.to_file line.

Make sure that you are using the correct variables.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.