Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
GeoDjango: Invalid spatial reference pointer returned from "OGR_L_GetSpatialRef"
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe  
View profile  
 More options Dec 12 2007, 9:19 pm
From: Joe <joesacco...@gmail.com>
Date: Wed, 12 Dec 2007 21:19:09 -0500
Local: Wed, Dec 12 2007 9:19 pm
Subject: GeoDjango: Invalid spatial reference pointer returned from "OGR_L_GetSpatialRef"
I'm following along with the GeoDjango_Presentation.pdf at [1] from
the FOSS4G 2007 presentation at [2], using the shapefile
'st99_d00.shp' from [3]. When trying the example code listed on the
bottom slide of page 11 in the pdf , I get an error:

    SRSException: Invalid spatial reference pointer returned from
"OGR_L_GetSpatialRef".

This occurs on both Debian Etch and OS X 10.4 (both are using GDAL
version 1.4.2 and python 2.4 with ctypes package installed). I'm just
starting out with GeoDjango so I'm not sure if it's an installation
problem or the code. I was able to successfully run the third-party
library installation tests at [4] and also the DataSource example at
[5], in case that helps to shed any light on the soundness of my
installation.

Should the example still work with the latest svn revision of
GeoDjango? The IPython session is pasted below.

Thanks,
Joe

[1] http://www.foss4g2007.org/presentations/viewattachment.php?attachment...
[2] http://www.foss4g2007.org/presentations/view.php?abstract_id=222
[3] http://www.census.gov/geo/cob/bdy/st/st00shp/st99_d00_shp.zip
[4] http://code.djangoproject.com/wiki/GeoDjangoInstall#Third-PartyLibrar...
[5] http://code.djangoproject.com/wiki/GeoDjangoExtras#DataSource

This IPython session is also pasted at http://dpaste.com/hold/27869/ :
==========================================================================

In [1]: from django.contrib.gis.utils import ogrinfo

In [2]: ogrinfo('st99_d00.shp',num_features=1)
data source : st99_d00.shp
==== layer 0
  shape type: Polygon
  # features: 273
---------------------------------------------------------------------------
django.contrib.gis.gdal.error.SRSException
 Traceback (most recent call last)

/home/joe/foss4g/<ipython console>

/usr/lib/python2.4/site-packages/django/contrib/gis/utils/ogrinfo.py
in ogrinfo(data_source, num_features)
     27         print "  shape type: %s" %
GEO_CLASSES[layer.geom_type.num].__name__
     28         print "  # features: %s" % len(layer)
---> 29         print "         srs: %s" % layer.srs
     30         extent_tup = layer.extent.tuple
     31         print "      extent: %s - %s" % (extent_tup[0:2],
extent_tup[2:4])

/usr/lib/python2.4/site-packages/django/contrib/gis/gdal/layer.py in srs(self)
    100     def srs(self):
    101         "Returns the Spatial Reference used in this Layer."
--> 102         ptr = get_layer_srs(self._ptr)
    103         if ptr:
    104             return SpatialReference(clone_srs(ptr))

/usr/lib/python2.4/site-packages/django/contrib/gis/gdal/prototypes/errchec k.py
in check_srs(result, func, cargs)
     89         result = c_void_p(result)
     90     if not result:
---> 91         raise SRSException('Invalid spatial reference pointer
returned from "%s".' % func.__name__)
     92     return result
     93

SRSException: Invalid spatial reference pointer returned from
"OGR_L_GetSpatialRef".


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Bronn  
View profile  
 More options Dec 12 2007, 10:12 pm
From: Justin Bronn <jbr...@gmail.com>
Date: Wed, 12 Dec 2007 19:12:04 -0800 (PST)
Local: Wed, Dec 12 2007 10:12 pm
Subject: Re: GeoDjango: Invalid spatial reference pointer returned from "OGR_L_GetSpatialRef"

> Should the example still work with the latest svn revision of
> GeoDjango? The IPython session is pasted below.

Yes, it should work.  You found a bug -- I just fixed it in r6916.

There have been some significant changes to GeoDjango since FOSS4G
(e.g., GEOS & GDAL refactors, distance queries, additional spatial
backends).  However, substantively, everything should still work as
shown.  This particular bug is an artifact of the GDAL library
refactoring: the census shapefiles do not explicitly give a spatial
reference, which is NAD83, and the `srs` property should be None
instead of raising an exception.  One thing that has explicitly
changed is that `models.GeoMixin` is no longer required for geographic
models.

Thanks for the detailed report and traceback.

Best Regards,
-Justin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe  
View profile  
 More options Dec 13 2007, 11:22 am
From: Joe <joesacco...@gmail.com>
Date: Thu, 13 Dec 2007 11:22:35 -0500
Local: Thurs, Dec 13 2007 11:22 am
Subject: Re: GeoDjango: Invalid spatial reference pointer returned from "OGR_L_GetSpatialRef"
On Dec 12, 2007 10:12 PM, Justin Bronn <jbr...@gmail.com> wrote:

> > Should the example still work with the latest svn revision of
> > GeoDjango? The IPython session is pasted below.

> Yes, it should work.  You found a bug -- I just fixed it in r6916.

The example works perfectly now. Thanks very much!

> There have been some significant changes to GeoDjango since FOSS4G
> (e.g., GEOS & GDAL refactors, distance queries, additional spatial
> backends).  However, substantively, everything should still work as
> shown.  This particular bug is an artifact of the GDAL library
> refactoring: the census shapefiles do not explicitly give a spatial
> reference, which is NAD83, and the `srs` property should be None
> instead of raising an exception.  One thing that has explicitly
> changed is that `models.GeoMixin` is no longer required for geographic
> models.

I appreciate your taking the time to explain the issue. It's very
helpful for someone just starting out with GeoDjango.

Thanks,
Joe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »