PostGIS Raster – How to Install raster2pgsql on CentOS7

postgispostgis-raster

I am running a postgis database on a server at work. The os is centos7, I can do more or less anything on the server, except for installing another os.

I want to upload some raster files to my database, so I need raster2pgsql, but it is not installed. I have the following relevant packages on my system:

postgis32_14.x86_64                      3.2.0-1.rhel7              @pgdg14
postgis32_14-utils.x86_64                3.2.0-1.rhel7              @pgdg14
postgresql14.x86_64                      14.1-1PGDG.rhel7           @pgdg14
postgresql14-contrib.x86_64              14.1-1PGDG.rhel7           @pgdg14
postgresql14-libs.x86_64                 14.1-1PGDG.rhel7           @pgAdmin4
postgresql14-server.x86_64               14.1-1PGDG.rhel7           @pgdg14

As far as I can see, postgis32_14-utils should provide raster2pgsql, but repoquery -l postgis32_14-utils returns nothing raster related. postgis32_14 contains a few raster related files, but no raster2pgsql. I cannot see any other postgis related packages.

As far as I know, raster2pgsql reads the raster and makes a sql file to import to the postgis server, so I guess using any version for postgis-3.x should work no matter the postgresql version?

Best Answer

When using PostGIS 3.0 and above, you need to install a postgis-client package (i.e. postgis32_14-client).

The earlier version of PostGIS (<3.0) contains raster2pgsql (as well shp2pgsql and pgsql2shp) in the same package. However, PostGIS 3 broke out the raster functionality as an independent extension (ref. Key Breaking Changes - PostGIS 3.0.0). This resulted in the creation of another package.

Also, you can find the package that contains a specific name file in pkgs.org. Please visit: Search Results for raster2pgsql.

Related Question