-1

I'm trying to convert geometries to images, and the functions to do so don't seem to exist.

The following example is from the ST_AsRaster Docs WHich specify the requirements are Availability: 2.0.0 - requires GDAL >= 1.6.0.

SELECT ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),150, 150));

This results in:

ERROR: function st_asraster(geometry, integer, integer) does not exist

LINE 1: SELECT ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),150,...

I found some info that points towards needing GDAL drivers, however, when I try:

SELECT short_name, long_name FROM ST_GdalDrivers();

I get:

ERROR: function st_gdaldrivers() does not exist

LINE 1: SELECT short_name, long_name FROM ST_GdalDrivers();


I have no idea where to even go to try solving this, why don't the functions exist, was there some config I needed to add, some doc I didn't read?

Even the https://postgis.net/docs/RT_reference.html seems to suggest that it should "just work"?


This is installed from the package manager on Ubuntu 20.0.4.

Version Info SELECT PostGIS_Full_Version();:

POSTGIS="3.0.0 r17983" [EXTENSION] 
PGSQL="120" 
GEOS="3.8.0-CAPI-1.13.1 " 
PROJ="6.3.1" 
LIBXML="2.9.4" 
LIBJSON="0.13.1" 
LIBPROTOBUF="1.3.3" 
WAGYU="0.4.3 (Internal)"
Douglas Gaskell
  • 9,017
  • 9
  • 71
  • 128

1 Answers1

3

You must have forgotten to install the postgis_raster extension:

CREATE EXTENSION postgis_raster;

This extension is new in PostGIS 3.0; before that, its objects were part of the postgis extension.

The documentation mentions that:

Once postgis is installed, it needs to be enabled in each individual database you want to use it in.

psql -d yourdatabase -c "CREATE EXTENSION postgis;"

-- if you built with raster support and want to install it --
psql -d yourdatabase -c "CREATE EXTENSION postgis_raster;"
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263