function st_coveredby(geometry, geometry) does not exist.

32 views
Skip to first unread message

J. Cliff Dyer

unread,
Oct 20, 2009, 10:55:48 AM10/20/09
to geod...@googlegroups.com
I've set up a view to allow me to draw a box on a map, and return all
objects from a given model that lie within the box. On one machine, it
works fine, but on another, I get this error:

"""
ProgrammingError at /maps/browse/spatial/POLYGON((36.18894141
-79.93652187, 36.18894141 -78.02490078, 34.78269141 -78.02490078,
34.78269141 -79.93652187, 36.18894141 -79.93652187))/
function st_coveredby(geometry, geometry) does not exist at character 116
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
"""

The view that is causing this error is as follows:

def spatial_search_list_view(request,
queryset,
search_area,
location_field='geography__bounding_box',
search_type='coveredby',
template_name='maps/spatial_list.html',
sort_field=None,
page=None):
try:
area = geos.fromstr(search_area)
except ValueError:
return HttpResponse('ValueError: Invalid search area—%s.' % search_area + ' Search terms must be given in WKT, EWKT or HEXEWKB formats.')
filter_key= '%s__%s' % (location_field, search_type)
result_list = queryset.filter(**{filter_key: area})
return search_list_view(request,
result_list,
sort_field=sort_field,
page=page,
template_name=template_name)

It is being called with default values, so stripped down to its essence,
the error is coming from this line:

queryset.filter(geography__bounding_box__coveredby=geos.fromstr(wkt))

On the machine that works, I am using:
* python 2.6.2,
* django 1.0.2,
* psql --version returns 3.8.3
* /usr/lib/libgeos-3.0.0.so
* /usr/lib/libgeos_c.so.1.4.1

On the machine that raises the ProgrammingError, I am using:
* python 2.4.3
* django 1.1.0
* psql --version returns 3.8.3
* /usr/lib/libgeos-3.0.3.so
* /usr/lib/libgeos_c.so.1.4.2

Any idea what could be causing this?

Cheers,
Cliff


J. Cliff Dyer

unread,
Oct 20, 2009, 11:34:11 AM10/20/09
to geod...@googlegroups.com
More server information:


On the working server:

[jcdyer@aalcdl07]$ apt-cache showpkg proj|head -n3
Package: proj
Versions: 4.6.0-2
[jcdyer@aalcdl07]$ apt-cache showpkg gdal-bin|head -n3
Package: gdal-bin
Versions: 1.5.2-3ubuntu1


On the broken one:

[root@frog /root]# rpm -q proj-4.6.1
proj-4.6.1-1.rhel5
[root@frog /root]# rpm -q gdal
gdal-1.4.4-2.rhel_5.4.unc

Cheers,
Cliff

Justin Bronn

unread,
Oct 20, 2009, 11:54:58 AM10/20/09
to geod...@googlegroups.com
What version of PostGIS do you have on both machines? `ST_CoveredBy`
was added in PostGIS 1.2.2 [1], and RedHat typically has older packages.
To determine the version, simply execute the following command,
substituting in the appropriate database name:

psql -d <db name> -c "SELECT postgis_full_version();"

-Justin

[1]
http://postgis.refractions.net/documentation/manual-1.4/ST_CoveredBy.html

J. Cliff Dyer

unread,
Oct 20, 2009, 1:08:19 PM10/20/09
to geod...@googlegroups.com


On the functional server (Ubuntu):

[jcdyer@aalcdl07]$ psql -d ncmaps -c "SELECT postgis_full_version();"
postgis_full_version
----------------------------------------------------------------------
POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0, 21 Dec
2007" USE_STATS
(1 row)


On the non-functional server (RHEL 5):

[jcdyer@frog]$ psql -d cdla_ncmaps -c "SELECT postgis_full_version();"
postgis_full_version
----------------------------------------------------------------------
POSTGIS="1.3.6" GEOS="3.0.3-CAPI-1.4.2" PROJ="Rel. 4.6.1, 21 August
2008" USE_STATS (procs from 1.3.3 need upgrade)
(1 row)

In this case, the RHEL release numbers are newer than the Ubuntu ones.
My sysadmins have custom-compiled some of the packages, and downloaded
others from pgdg which might account for that.

Cheers,
Cliff


Reply all
Reply to author
Forward
0 new messages