ERROR: GetProj4StringSPI: Cannot find SRID (4326) in spatial_ref_sys

If you are using postgis and a cleaner in your database, maybe you could have this error:

ERROR:  GetProj4StringSPI: Cannot find SRID (4326) in spatial_ref_sys
SQL state: XX000

This error means that your spatial_ref_sys table is empty
To fix it, just restore the information that postgis generate when you create this extension in your database.
To do it execute the following sentence:

psql -d $database_name -f $PATH/spatial_ref_sys.sql

where the PATH is the path to spatial_ref_sys.sql
For postgres 11 and postgis 2.5 the PATH is /usr/share/postgresql/11/contrib/postgis-2.5/

Other way to execute the same command is:

PGPASSWORD=postgres psql "host=localhost dbname=$database_name user=postgres" -f /usr/share/postgresql/11/contrib/postgis-2.5/spatial_ref_sys.sql

Enjoy it!

Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

Webcam streaming throught VLC with YUY2 compatibility