关于Postgis的安装使用,建议参考官方手册 http://www.postgis.org/docs/ch02.html
------------------------------------------
创建控件数据库的参考:
createdb yourdatabase
createlang plpgsql yourdatabase
psql -d yourdatabase -f postgis.sql
psql -d yourdatabase -f postgis_comments.sql
psql -d yourdatabase -f spatial_ref_sys.sql
------------------------------------------------
2.5. Create a spatially-enabled databaseThe first step in creating a PostGIS database is to create a simple Postgresql database.
createdb [yourdatabase]
Many of the PostGIS functions are written in the PL/pgsql procedural language. As such,the next step to create a PostGIS database is to enable the PL/pgsql language in your new database. This is accomplish by the command
createlang plpgsql [yourdatabase]
Now load the PostGIS object and function deFinitions into your database by loading the postgis.sql
deFinitions file (located in [prefix]/share/contrib
as specifIEd during the configuration step).
psql -d [yourdatabase] -f postgis.sql
For a complete set of epsg coordinate system deFinition IDentifIErs,you can also load the spatial_ref_sys.sql
deFinitions file and populate the spatial_ref_sys
table. This will permit you to perform ST_transform() operations on geometrIEs.
psql -d [yourdatabase] -f spatial_ref_sys.sql
If you wish to add comments to the PostGIS functions,the final step is to load the postgis_comments.sql
into your spatial database. The comments can be vIEwed by simply tyPing \dd [function_name] from a psql terminal window.
psql -d [yourdatabase] -f postgis_comments.sql
2.6. Create a spatially-enabled database from a templateSome packaged distributions of PostGIS (in particular the Win32 installers for PostGIS >= 1.1.5) load the PostGIS functions into a template database called template_postgis
. If the template_postgis
database exists in your Postgresql installation then it is possible for users and/or applications to create spatially-enabled databases using a single command. Note that in both cases,the database user must have been granted the privilege to create new databases.
From the shell:
# createdb -T template_postgis my_spatial_db
From sql:
postgres=# CREATE DATABASE my_spatial_db TEMPLATE=template_postgis
--------------------------------------------------------------
如果系统中没有存在template_postgis模板,需要自己手动创建,
$psql template1
template1=#create database template_postgis with template=template1;
template1=#update pg_database set datistemplate=TRUE where datname='template_postgis';
template1=#\c template_postgis
template_postgis=#create language plpgsql;
template_postgis=#\i /opt/locale/share/postgis/lwpostgis.sql;
template_postgis=#\i /opt/locale/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;
template_postgis=#VACUUM FREEZE;
template_postgis=#\q
对于用户,即可创建数据库
createdb test_gis_db -T template_postgis
dropdb test_gis_db
此部分参考 http://www.360doc.com/content/09/0220/11/1484_2597100.shtml
总结以上是内存溢出为你收集整理的关于postgis的安装使用全部内容,希望文章能够帮你解决关于postgis的安装使用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)