Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to use some Geography functions, but I am getting an error that (all) functions are not existing. I have checked other Stackexchange posts (e.g. this one), but the solutions did not work for me.

Since no function is available, I assume that something is wrong with the geography tables. I am using POSTGIS 2.0.1, therefore the geography functions should be supported.

database# select postgis_full_version(); 
POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL
1.9.1, released 2012/05/15" LIBXML="2.7.3" LIBJSON="UNKNOWN" TOPOLOGY RASTER

I can see the geography tables in the database and the database owner also owns the geography tables.

 public   | geography_columns | view     | developer
 public   | geometry_columns  | view     | developer
 public   | raster_columns    | view     | developer
 public   | raster_overviews  | view     | developer

What could cause the error below?

function st_collect(geography) does not exist
LINE 1: SELECT ST_xMin(ST_Collect(location)) AS id, ST_xMax(ST_Colle...
                       ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

According to www.postgis.org/docs/ST_Collect,

ST_Collect — Return a specified ST_Geometry value from a collection of other geometries.

(emphasis mine) but it seems your location column is of type geography.

Perhaps you need to convert the geography to a geometry via casting:

St_Collect (location::geometry)
share|improve this answer
1  
Indeed, only a small subset of functions are implemented for geography. For all others, just cast, as suggested here. –  Paul Ramsey Mar 28 at 7:05
    
Thank you for your answers. The hint regarding geography vs. geometry reminded me that I put geography=True in the GeoDjango model. –  neurix Mar 28 at 17:56
    
If you want geography back you need to cast back. So ST_Collect(location::geometry)::geography –  LR1234567 Apr 5 at 4:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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