Re: [postgis-users] Error with ST functions
HI, I'have tried to reinstall postgis. But i still get errors like this one: SELECT ST_clip(True,polygon.geom, raster.rast) FROM public.edifici as polygon, public.ele1000x1000 as raster; ERROR: function st_clip(boolean, geometry, raster) does not exist LINE 2: ST_clip(True,polygon.geom, raster.rast) ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. gis=# SELECT n.nspname, p.proname, array_agg(t.typname) FROM pg_proc p, pg_namespace n, pg_type t WHERE p.proname = 'st_clip' AND n.oid = p.pronamespace AND t.oid = any (p.proargtypes) GROUP BY n.nspname, p.proname, p.oid; nspname | proname | array_agg -+-+-- public | st_clip | {bool,_float8,geometry,raster} public | st_clip | {bool,_int4,_float8,geometry,raster} public | st_clip | {bool,float8,geometry,raster} public | st_clip | {bool,int4,float8,geometry,raster} public | st_clip | {bool,int4,geometry,raster} public | st_clip | {bool,geometry,raster} 2015-11-19 18:38 GMT+01:00 Sandro Santilli: > On Thu, Nov 19, 2015 at 06:25:46PM +0100, Lorenzo Bottaccioli wrote: > > grep -i st_bandisnodata rtpostgis.sql > > CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, band integer > > DEFAULT 1, forceChecking boolean DEFAULT FALSE) > > CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, forceChecking > > boolean) > > AS $$ SELECT st_bandisnodata($1, 1, $2) $$ > > Right, so someone tempered with the db. > There might be more things missing. > > One way to check what else is missing would be: > > BEGIN; > CREATE EXTENSION postgis VERSION '2.1.2' FROM 'unpackaged'; > -- you'd get an error here, if anything is missing > ROLLBACK; -- we're just checking, right? > > Let me know if you need help with fixing things. > > --strk; > > () Free GIS & Flash consultant/developer > /\ http://strk.keybit.net/services.html > ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
Lorenzo, There is nothing wrong here except your query. There is no such signature as ST_Clip(Boolean, geom,rast) It's ST_Clip(geom,rast, boolean) Your proc query did the array agg of protos out of sequence. Easiest way to see this is just open a psql console and run \df st_clip And you should see this though your schema location is probably different from mine. List of functions Schema | Name | Result data type | Argument data types | Type -+-+--+---+ postgis | st_clip | raster | rast raster, geom geometry, crop boolean | normal postgis | st_clip | raster | rast raster, geom geometry, nodataval double precision, crop boolean DEFAULT true | normal postgis | st_clip | raster | rast raster, geom geometry, nodataval double precision[] DEFAULT NULL::double precision[], crop boolean DEFAULT true | normal postgis | st_clip | raster | rast raster, nband integer, geom geometry, crop boolean | normal postgis | st_clip | raster | rast raster, nband integer, geom geometry, nodataval double precision, crop boolean DEFAULT true | normal postgis | st_clip | raster | rast raster, nband integer[], geom geometry, nodataval double precision[] DEFAULT NULL::double precision[], crop boolean DEFAULT true | normal (6 rows) Or look at the manual http://postgis.net/docs/RT_ST_Clip.html Hope that helps, Regina http://www.postgis.us http://postgis.net From: postgis-users [mailto:postgis-users-boun...@lists.osgeo.org] On Behalf Of Lorenzo Bottaccioli Sent: Friday, November 20, 2015 7:10 AM To: Lorenzo Bottaccioli <lorenzo.bottacci...@gmail.com>; PostGIS Users Discussion <postgis-users@lists.osgeo.org> Subject: Re: [postgis-users] Error with ST functions HI, I'have tried to reinstall postgis. But i still get errors like this one: SELECT ST_clip(True,polygon.geom, raster.rast) FROM public.edifici as polygon, public.ele1000x1000 as raster; ERROR: function st_clip(boolean, geometry, raster) does not exist LINE 2: ST_clip(True,polygon.geom, raster.rast) ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. gis=# SELECT n.nspname, p.proname, array_agg(t.typname) FROM pg_proc p, pg_namespace n, pg_type t WHERE p.proname = 'st_clip' AND n.oid = p.pronamespace AND t.oid = any (p.proargtypes) GROUP BY n.nspname, p.proname, p.oid; nspname | proname | array_agg -+-+-- public | st_clip | {bool,_float8,geometry,raster} public | st_clip | {bool,_int4,_float8,geometry,raster} public | st_clip | {bool,float8,geometry,raster} public | st_clip | {bool,int4,float8,geometry,raster} public | st_clip | {bool,int4,geometry,raster} public | st_clip | {bool,geometry,raster} 2015-11-19 18:38 GMT+01:00 Sandro Santilli <s...@keybit.net <mailto:s...@keybit.net> >: On Thu, Nov 19, 2015 at 06:25:46PM +0100, Lorenzo Bottaccioli wrote: > grep -i st_bandisnodata rtpostgis.sql > CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, band integer > DEFAULT 1, forceChecking boolean DEFAULT FALSE) > CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, forceChecking > boolean) > AS $$ SELECT st_bandisnodata($1, 1, $2) $$ Right, so someone tempered with the db. There might be more things missing. One way to check what else is missing would be: BEGIN; CREATE EXTENSION postgis VERSION '2.1.2' FROM 'unpackaged'; -- you'd get an error here, if anything is missing ROLLBACK; -- we're just checking, right? Let me know if you need help with fixing things. --strk; () Free GIS & Flash consultant/developer /\ http://strk.keybit.net/services.html ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
Hi, (how) did you enable PostGIS for the database you're using ? SELECT postgis_full_version(); --strk; the reuslt of the query is: POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER As an addition, you need to have the public schema in your search path, at > least. > It is the case by default, unless you tweeked it. > > SET search_path TO 'public' ; > I'have tried this but there is no difference. Best Lorenzo ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
As an addition, you need to have the public schema in your search path, at least. It is the case by default, unless you tweeked it. SET search_path TO 'public' ; Cheers, Rémi-C 2015-11-18 19:59 GMT+01:00 Sandro Santilli: > On Wed, Nov 18, 2015 at 07:54:19PM +0100, Lorenzo Bottaccioli wrote: > > > *ERROR: function st_bandisnodata(raster) does not exist* > > *LINE 1: SELECT ST_BandIsNoData(rast) from mytable;* > > * ^* > > *HINT: No function matches the given name and argument types. You might > > need to add explicit type casts.* > > > > Any suggestion how to solve this? > > > > I get the same error with many other functions. > > (how) did you enable PostGIS for the database you're using ? > SELECT postgis_full_version(); > > --strk; > ___ > postgis-users mailing list > postgis-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
On Thu, Nov 19, 2015 at 11:33:12AM +0100, Lorenzo Bottaccioli wrote: > *ERROR: function st_bandisnodata(raster) does not exist* [..] > POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 > March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" > LIBJSON="UNKNOWN" RASTER How about these: SELECT n.nspname, p.proname, array_agg(t.typname) FROM pg_proc p, pg_namespace n, pg_type t WHERE p.proname = 'st_bandisnodata' AND n.oid = p.pronamespace AND t.oid = any (p.proargtypes) GROUP BY n.nspname, p.proname, p.oid; SHOW search_path; --strk; () Free GIS & Flash consultant/developer /\ http://strk.keybit.net/services.html ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
> > How about these: > > SELECT > n.nspname, p.proname, array_agg(t.typname) > FROM > pg_proc p, pg_namespace n, pg_type t > WHERE p.proname = 'st_bandisnodata' >AND n.oid = p.pronamespace >AND t.oid = any (p.proargtypes) > GROUP BY >n.nspname, p.proname, p.oid; > response: nspname | proname | array_agg -+-+--- public | st_bandisnodata | {bool,raster} (1 row) > SHOW search_path; search_path "$user",public (1 row) regards ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
SELECT extname, extversion from pg_extension; extname | extversion -+ plpgsql | 1.0 (1 row) 2015-11-19 17:40 GMT+01:00 Sandro Santilli: > On Thu, Nov 19, 2015 at 02:00:05PM +0100, Lorenzo Bottaccioli wrote: > > > > > > How about these: > > > > > > SELECT > > > n.nspname, p.proname, array_agg(t.typname) > > > FROM > > > pg_proc p, pg_namespace n, pg_type t > > > WHERE p.proname = 'st_bandisnodata' > > >AND n.oid = p.pronamespace > > >AND t.oid = any (p.proargtypes) > > > GROUP BY > > >n.nspname, p.proname, p.oid; > > > > > > > response: > > nspname | proname | array_agg > > -+-+--- > > public | st_bandisnodata | {bool,raster} > > (1 row) > > This isn't the answer you'd get with a fresn install of 2.1.2. > This is: > >nspname | proname | array_agg > -+-+ >public | st_bandisnodata | {bool,raster} >public | st_bandisnodata | {bool,int4,raster} > > You reported postgis_full_version() response of: > > POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 > March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" > LIBJSON="UNKNOWN" RASTER > > But didn't say how you enabled it. > > SELECT extname, extversion from pg_extension; > > --strk; > ___ > postgis-users mailing list > postgis-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/postgis-users > ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
On Thu, Nov 19, 2015 at 02:00:05PM +0100, Lorenzo Bottaccioli wrote: > > > > How about these: > > > > SELECT > > n.nspname, p.proname, array_agg(t.typname) > > FROM > > pg_proc p, pg_namespace n, pg_type t > > WHERE p.proname = 'st_bandisnodata' > >AND n.oid = p.pronamespace > >AND t.oid = any (p.proargtypes) > > GROUP BY > >n.nspname, p.proname, p.oid; > > > > response: > nspname | proname | array_agg > -+-+--- > public | st_bandisnodata | {bool,raster} > (1 row) This isn't the answer you'd get with a fresn install of 2.1.2. This is: nspname | proname | array_agg -+-+ public | st_bandisnodata | {bool,raster} public | st_bandisnodata | {bool,int4,raster} You reported postgis_full_version() response of: POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER But didn't say how you enabled it. SELECT extname, extversion from pg_extension; --strk; ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
On Thu, Nov 19, 2015 at 05:53:47PM +0100, Lorenzo Bottaccioli wrote: > SELECT extname, extversion from pg_extension; > extname | extversion > -+ > plpgsql | 1.0 > (1 row) [...] > POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel.4.8.0, 6 March > 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" > LIBJSON="UNKNOWN" RASTER So not via extension. Was this database upgraded from a previous version of PostGIS or installed new ? Did you build PostGIS yourself or installed from packages ? The point is that the install is broken (either by how you got there or by subsequent tampering). --strk; ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
Postgis installed by ubuntu repository, then createdb mydb psql -d mydb -f postgis_comments.sql psql -d mydb -f spatial_ref_sys.sql psql -d mydb -f rtpostgis.sql psql -d mydb -f raster_comments.sql psql -d mydb -f topology.sql psql -d mydb -f topology_comments.sql 2015-11-19 18:03 GMT+01:00 Sandro Santilli: > On Thu, Nov 19, 2015 at 05:53:47PM +0100, Lorenzo Bottaccioli wrote: > > SELECT extname, extversion from pg_extension; > > extname | extversion > > -+ > > plpgsql | 1.0 > > (1 row) > > [...] > > > POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel.4.8.0, 6 > March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" > LIBJSON="UNKNOWN" RASTER > > So not via extension. > > Was this database upgraded from a previous version of PostGIS or > installed new ? Did you build PostGIS yourself or installed from > packages ? > > The point is that the install is broken > (either by how you got there or by subsequent tampering). > > --strk; > ___ > postgis-users mailing list > postgis-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/postgis-users > ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
On Thu, Nov 19, 2015 at 06:10:52PM +0100, Lorenzo Bottaccioli wrote: > Postgis installed by ubuntu repository, then > > createdb mydb > psql -d mydb -f postgis_comments.sql > psql -d mydb -f spatial_ref_sys.sql > psql -d mydb -f rtpostgis.sql > psql -d mydb -f raster_comments.sql > psql -d mydb -f topology.sql > psql -d mydb -f topology_comments.sql See if the sourced file did contain that function: grep -i st_bandisnodata rtpostgis.sql You should see this line: CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, band integer DEFAULT 1, forceChecking boolean DEFAULT FALSE) If not, it'd be a broken package. If you find it, someone must have removed that function later. It should be possible to get it back by: psql -d mydb -f rtpostgis_upgrade_21_minor.sql --strk; () Free GIS & Flash consultant/developer /\ http://strk.keybit.net/services.html ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
grep -i st_bandisnodata rtpostgis.sql CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, band integer DEFAULT 1, forceChecking boolean DEFAULT FALSE) CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, forceChecking boolean) AS $$ SELECT st_bandisnodata($1, 1, $2) $$ 2015-11-19 18:23 GMT+01:00 Sandro Santilli: > On Thu, Nov 19, 2015 at 06:10:52PM +0100, Lorenzo Bottaccioli wrote: > > Postgis installed by ubuntu repository, then > > > > createdb mydb > > psql -d mydb -f postgis_comments.sql > > psql -d mydb -f spatial_ref_sys.sql > > psql -d mydb -f rtpostgis.sql > > psql -d mydb -f raster_comments.sql > > psql -d mydb -f topology.sql > > psql -d mydb -f topology_comments.sql > > See if the sourced file did contain that function: > > grep -i st_bandisnodata rtpostgis.sql > > You should see this line: > > CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, band integer > DEFAULT 1, forceChecking boolean DEFAULT FALSE) > > If not, it'd be a broken package. > If you find it, someone must have removed that function later. > It should be possible to get it back by: > > psql -d mydb -f rtpostgis_upgrade_21_minor.sql > > --strk; > > () Free GIS & Flash consultant/developer > /\ http://strk.keybit.net/services.html > > ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
On Thu, Nov 19, 2015 at 06:25:46PM +0100, Lorenzo Bottaccioli wrote: > grep -i st_bandisnodata rtpostgis.sql > CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, band integer > DEFAULT 1, forceChecking boolean DEFAULT FALSE) > CREATE OR REPLACE FUNCTION st_bandisnodata(rast raster, forceChecking > boolean) > AS $$ SELECT st_bandisnodata($1, 1, $2) $$ Right, so someone tempered with the db. There might be more things missing. One way to check what else is missing would be: BEGIN; CREATE EXTENSION postgis VERSION '2.1.2' FROM 'unpackaged'; -- you'd get an error here, if anything is missing ROLLBACK; -- we're just checking, right? Let me know if you need help with fixing things. --strk; () Free GIS & Flash consultant/developer /\ http://strk.keybit.net/services.html ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users
Re: [postgis-users] Error with ST functions
On Wed, Nov 18, 2015 at 07:54:19PM +0100, Lorenzo Bottaccioli wrote: > *ERROR: function st_bandisnodata(raster) does not exist* > *LINE 1: SELECT ST_BandIsNoData(rast) from mytable;* > * ^* > *HINT: No function matches the given name and argument types. You might > need to add explicit type casts.* > > Any suggestion how to solve this? > > I get the same error with many other functions. (how) did you enable PostGIS for the database you're using ? SELECT postgis_full_version(); --strk; ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/postgis-users