GeoDjango GDAL_ERROR when uplading .shp

Try to parse a .shp in django shell:

from django.contrib.gis.gdal import DataSource
ds = DataSource('/Users/.../Downloads/Iceland.shp')


GDAL_ERROR 4: Unable to open /Users/.../Downloads/Iceland.shx or /Users/.../Downloads/Iceland.SHX.

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/.../lib/python2.7/site-packages/django/contrib/gis/gdal/", line 78, in __init__
    raise GDALException('Could not open the datasource at "%s"' % ds_input)
GDALException: Could not open the datasource at "/Users/.../Downloads/Iceland.shp"

File exists, chmod is 755, .shx file is correct (tested in online services). Then I try to test .kml file and it works

OS: Mac OS X 10.10.5

You are missing "Iceland.shx" file. It should be in the same archive as Iceland.shp. Just put it in the same directory. I've tried this files: and catch same error.

If it will not help, there some other options how to debug:

  1. Check the mandatory .shx, .shp and .dbf files are in the same directory.
  2. Check no other programs have the shapefile open (and locked).
  3. Open the shapefile in QGIS/ArcGIS and validate geometry.
  4. Try another shapefile

LayerMapping data import utility | Django documentation, prj : Contains the spatial reference information for the geographic data stored in the shapefile. Use ogrinfo to examine spatial data¶. The GDAL ogrinfo utility allows  I've already followed tutorials on django (geodjango for web maps) and I can not display my shapefile (polygons) on the web. . these shapefiles were imported into postgis via cmd console. . so establishment of the connection between posgresql and django is true.

I need to add that I have the same error when I tried to run the command:

python ogrinspect /map/data/points.shp BuildingFootprints --srid=4326 --mapping --multi

And the error was generated because of a backslash before the map, so it passed when I run:

python ogrinspect map/data/points.shp BuildingFootprints --srid=4326 --mapping --multi

When I was looking for my solution I found this question, which is answered. Anyway, I wanted to post this answer for those people who came here like I do a few min ago. Maybe someone help.

GeoDjango Tutorial | Django documentation, GDAL ogrinfo : Lists information about an OGR supported data source. $ ogrinfo data/tha_adm2_gista_plyg_v5/THA_Adm2_GISTA_plyg_v5.shp  The demo image is available on Docker Hub: sanagama/geodjango-postgresql-demo. Copy/paste the command below into a Command or Terminal window to get the Docker image: docker pull sanagama/geodjango-postgresql-demo 3. Pre-create the Azure Database for PostgreSQL server for the demo web app

python ogrinspect map/data/points.shp BuildingFootprints --srid=4326 --mapping --multi

Ensure your data is located in the folder... map/data/points.shp BuildingFootprints

GeoDjango Loading a Shapefile into PostGIS, I am not sure if this will answer your question but when I first started using geodjango the I had problems importing both the regular django  GeoDjango Building Blocks GeoDjango installation is based on Python, Django and two kinds of components: a Spatial Database and Geospatial libraries 1) Spatial Database A spatial database like PostGis (recommended), MySQL Spatial and Oracle Spatial (and since some day also SpatiaLite, that is an excellent option for development purposes)

Loading shapefile in GeoDjango and displaying it in admin section , On trying to execute ogrinfo i got this error: ogrinfo: symbol lookup error: Is it possible to set up the Django Admin to be able to upload shapefiles to PostGIS? Right now I GeoDjango: GDAL library is not available to transform() geometry. GeoDjango creator, Justin Bronn, was interviewed on Episode 32 of This Week in Django GeoDjango was featured in a presentation and tutorial session at O'Reilly's Where 2.0 Conference , May 12-14, 2008 in Burlingame, California.

Newest 'geodjango' Questions - Page 2, Installing Python 3; Installing GeoDjango Dependencies (GEOS, GDAL, and To solve the error, you simply need to install the psycopg2-binary in your virtual Create the app; Add a Shop model; Add a data migration for loading initial demo​  This is the second tutorial in this series that introduces the user on how to develop models to accommodate spatial data and configuration of spatial databases for a Geodjango project.

Make a Location-Based Web App With Django and GeoDjango , If not, something is amiss with your GDAL installation. You should notice an error page welcoming you to Django, but pointing out there's We're now going to import some administrative boundaries from a shapefile into GeoDjango. Now, instead of loading data from the KML view we created earlier, we're going to 

  • I would try a few more things: 1. Check the mandatory .shx, .shp and .dbf files are in the same directory. 2. Check no other programs have the shapefile open (and locked). 3. Open the shapefile in QGIS/ArcGIS and validate geometry. 4. Try another shapefile.