Im going through the GeoDjango Tutorial. I have loaded the WorldBorders shapefile into Spatialite. I can do spatial queries such contains, intersects, but I have a DatabaseError: no such table: spatial_ref_sys when I'm trying to use GeoQuerySet method such this one:

qs = WorldBorder.objecs.filter(name='Canada')

I have created the database using Spatialite 4.0 GUI. so the SELECT InitSpatialMetaData(); was performed on creation. SELECT * from spatial_ref_sys return all spatial_ref_sys objects.

Can the problem be that the WorldBorders table is in WGS84 and GeoQuerySet method such area() can only be performed with projected SRID?

Thanks for your help

Edit: The tutorial is the following: https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/

django version: 1.4.3

sqlite3 version is:

spatialite version is: 4.0.0

Performing: SELECT * FROM spatial_ref_sys LIMIT 3

-1|NONE|-1|Undefined - Cartesian||Undefined 0|NONE|0|Undefined - Geographic Long/Lat||Undefined 2000|epsg|2000|Anguilla 1957 / British West Indies Grid|+proj=tmerc +lat_0=0 +lo n_0=-62 +k=0.9995000000000001 +x_0=400000 +y_0=0 +ellps=clrk80 +units=m +no_defs |PROJCS["Anguilla 1957 / British West Indies Grid",GEOGCS["Anguilla 1957",DATUM[ "Anguilla_1957",SPHEROID["Clarke 1880 (RGS)",6378249.145,293.465,AUTHORITY["EPSG ","7012"]],AUTHORITY["EPSG","6600"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901 "]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG", "4600"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PAR AMETER["central_meridian",-62],PARAMETER["scale_factor",0.9995],PARAMETER["false _easting",400000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG", "9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","2000"]]

  • Can you please edit your post above to link to the tutorial you are using, identify which version of GeoDjango you have, and which version of sqlite and spatialite are really being used by that version of geodjango (e.g. a SELECT query for spatialite_version() and sqlite_version())?
    – BradHards
    Mar 20, 2013 at 20:08
  • Ok I have edited the post Mar 20, 2013 at 20:19
  • Do you really mean name=, or should that be field_name=? Can you try posting the output of your "SELECT * from spatial_ref_sys" query (or at least the header and the first five lines)?
    – BradHards
    Mar 20, 2013 at 21:46
  • the first code line is good. Im not sure about qs.area(), maybe its where the error come from. I'll post the spatial_ref_sys tomorrow Mar 20, 2013 at 22:14

1 Answer 1


Im sorry about this post. This was my error. My Django settings was pointing to a different sqlite database that I was thinking, and this database was not initiated with SELECT InitSpatialMetaData();

Once it was initiated, I dont have the error anymore.

  • Can you just mark this as "answer" when you can?
    – BradHards
    Mar 22, 2013 at 6:22

Your Answer

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

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