如何使用 PostGIS 扩展创建新数据库

How to create a new database with the PostGIS extensions

我在 docker 中安装了 PostGis,在标准数据库中有所有必要的扩展,但是在创建新的时有 none,我需要做什么来解决这个问题?

如果您已经在系统中安装了库,只需连接到数据库geo并执行创建扩展:

CREATE EXTENSION postgis

请记住,您必须另外 CREATE EXTENSION 在您想要的数据库中,除非您基于已安装 PostGIS 的模板创建数据库。

来自PostGIS documentation :

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