打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Creating a PostGIS template
userphoto

2009.02.20

关注

http://wiki.nofxx.com/postgre

Creating a PostGIS template

The following is adapted from Rob Braswell’s instructions. This allows non-superusers to create spatial databases using a template.

  • Connect to the template database
    $ psql template1

  • Execute the following commands:
    template1=# create database template_postgis with template = template1;
    template1=# UPDATE pg_database SET datistemplate = TRUE where datname = 'template_postgis';

  • Connect to the new template_postgis database:
    template1=# \c template_postgis

  • Add PostGIS extensions and grant access to everyone to spatial tables:
    template_postgis=# CREATE LANGUAGE plpgsql;
    template_postgis=# \i /opt/local/share/postgis/lwpostgis.sql;
    template_postgis=# \i /opt/local/share/postgis/spatial_ref_sys.sql;
    template_postgis=# GRANT ALL ON geometry_columns TO PUBLIC;
    template_postgis=# GRANT ALL ON spatial_ref_sys TO PUBLIC;

  • Prevent further modifications to the template_postgis database:
    template_postgis=# VACUUM FREEZE;

  • Quit out of psql (^D or \q)

  • Create a test database using the new template_postgis template…
    $ createdb test_gis_db -T template_postgis
    …and drop it again.
    $ dropdb test_gis_db

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
OushuDB 数据库基本用法(中)
PostgreSQL11.3 创建用户和创建数据库
浅谈PostgreSQL用户权限
玩开源GIS的一点心得
Mysql中文乱码问题完美解决方案
subversion
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服