PostGIS

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(文档)
 
(未显示2个用户的20个中间版本)
第1行: 第1行:
 +
{{SeeWikipedia}}
 +
 
PostGIS adds support for geographic objects to the [[PostgreSQL]] object-relational database. In effect, PostGIS "spatially enables" the PostgreSQL server, allowing it to be used as a backend spatial database for geographic information systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. PostGIS follows the OpenGIS "Simple Features Specification for SQL" and has been certified as compliant with the "Types and Functions" profile.
 
PostGIS adds support for geographic objects to the [[PostgreSQL]] object-relational database. In effect, PostGIS "spatially enables" the PostgreSQL server, allowing it to be used as a backend spatial database for geographic information systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. PostGIS follows the OpenGIS "Simple Features Specification for SQL" and has been certified as compliant with the "Types and Functions" profile.
  
 
==Install==
 
==Install==
 
When you install PostgreSQL, do not install the PostGIS included in the PostgreSQL installer, it is often a few versions behind.Instead, use the separate PostGIS installer.
 
When you install PostgreSQL, do not install the PostGIS included in the PostgreSQL installer, it is often a few versions behind.Instead, use the separate PostGIS installer.
 +
 +
Mac
  
 
Linux & UNIX
 
Linux & UNIX
第18行: 第22行:
 
  postgis=# SELECT postgis_version();
 
  postgis=# SELECT postgis_version();
  
==Links==
+
==DB initialization==
*http://postgis.refractions.net
+
*createdb test-gis
 +
*createlang plpgsql test-gis
 +
*psql -f /usr/share/postgresql-8.1-postgis/lwpostgis.sql -d test-gis
 +
*psql -f /usr/share/postgresql-8.1-postgis/spatial_ref_sys.sql -d test-gis
 +
or sql in E:\PostgreSQL\8.3\share\contrib
 +
 
 +
two OpenGIS meta-data tables: SPATIAL_REF_SYS and GEOMETRY_COLUMNS.
 +
 
 +
CREATE TABLE spatial_ref_sys
 +
(
 +
  srid integer NOT NULL,
 +
  auth_name character varying(256),
 +
  auth_srid integer,
 +
  srtext character varying(2048),
 +
  proj4text character varying(2048),
 +
  CONSTRAINT spatial_ref_sys_pkey PRIMARY KEY (srid)
 +
)
 +
 
 +
CREATE TABLE geometry_columns (
 +
  f_table_catalog    VARRCHAR(256) NOT NULL,
 +
  f_table_schema    VARCHAR(256) NOT NULL,
 +
  f_table_nam        VARCHAR(256) NOT NULL,
 +
  f_geometry_column  VARCHAR(256) NOT NULL,
 +
  coord_dimension    INTEGER NOT NULL,
 +
  srid              INTEGER NOT NULL,
 +
  type              VARCHAR(30) NOT NULL
 +
)
 +
==template_postgis==
 +
template_postgis template database include PostGIS functions
 +
 
 +
create spatially-enabled databases
 +
createdb -T template_postgis my_spatial_db
 +
or
 +
CREATE DATABASE my_spatial_db TEMPLATE=template_postgis
 +
==SRID==
 +
The OpenGIS specification also requires that the internal storage format of spatial objects include a spatial referencing system identifier (SRID). The SRID is required when creating spatial objects for insertion into the database.
 +
==shp2pgsql==
 +
shp2pgsql - shapefile to postgis loader
 +
 
 +
The shp2pgsql data loader converts ESRI Shape files into SQL suitable for insertion into a PostGIS/PostgreSQL database.
 +
 
 +
examples:
 +
shp2pgsql shaperoads roadstable roadsdb > roads.sql
 +
psql -d roadsdb -f roads.sql
 +
shp2pgsql shaperoads roadstable roadsdb | psql -d roadsdb
 +
==文档==
 +
*[http://docs.huihoo.com/postgresql/pgcon/2014/postgis-open-cloud PostGIS in the Open Cloud]
 +
*[http://docs.huihoo.com/postgresql/pgcon/2012/Making-your-own-maps.pdf Making your own maps]
 +
*[http://docs.huihoo.com/postgresql/pgcon/2011/PostGIS-Knows-Where-You-Are.pdf PostGIS Knows Where You Are]
 +
*[http://docs.huihoo.com/postgresql/pgcon/2009/Spatial-Analysis-with-PostGIS.pdf Spatial Analysis with PostGIS]、[http://docs.huihoo.com/postgresql/pgcon/2009/spatial-analysis-with-postgis/ Movie]、[http://docs.huihoo.com/postgresql/pgcon/2009/Spatial-Analysis-with-PostGIS.sql SQL]
 +
*[http://docs.huihoo.com/postgresql/pgcon/2009/Saving-the-Amazon-with-PostGIS.pdf Saving the Amazon with PostGIS]
 +
*[http://docs.huihoo.com/postgresql/pgcon/2009/OpenStreetMap-with-PostgreSQL.pdf OpenStreetMap with PostgreSQL]
 +
*[http://docs.huihoo.com/postgresql/pgcon/2008/PostGIS-A-Standards-Based-Geographic-Extension-for-PostgreSQL.pdf PostGIS: A Standards Based Geographic Extension for PostgreSQL]
 +
 
 +
==链接==
 +
*http://www.postgis.org/
 +
*http://download.huihoo.com/postgis/
 +
*http://docs.huihoo.com/postgis/
 +
 
 +
[[category:GIS]]
 +
[[category:PostgreSQL]]

2015年2月27日 (五) 08:42的最后版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 PostGIS Thanks, Wikipedia.

PostGIS adds support for geographic objects to the PostgreSQL object-relational database. In effect, PostGIS "spatially enables" the PostgreSQL server, allowing it to be used as a backend spatial database for geographic information systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. PostGIS follows the OpenGIS "Simple Features Specification for SQL" and has been certified as compliant with the "Types and Functions" profile.

目录

[编辑] Install

When you install PostgreSQL, do not install the PostGIS included in the PostgreSQL installer, it is often a few versions behind.Instead, use the separate PostGIS installer.

Mac

Linux & UNIX

tar xvfz postgis-1.3.1.tar.gz
cd postgis-1.3.1
./configure
make
make install
createlang plpgsql yourtestdatabase
psql -d yourtestdatabase -f lwpostgis.sql
psql -d yourtestdatabase -f spatial_ref_sys.sql

or Windows

http://postgis.refractions.net/download/windows/
psql -U postgres postgis
postgis=# SELECT postgis_version();

[编辑] DB initialization

  • createdb test-gis
  • createlang plpgsql test-gis
  • psql -f /usr/share/postgresql-8.1-postgis/lwpostgis.sql -d test-gis
  • psql -f /usr/share/postgresql-8.1-postgis/spatial_ref_sys.sql -d test-gis
or sql in E:\PostgreSQL\8.3\share\contrib

two OpenGIS meta-data tables: SPATIAL_REF_SYS and GEOMETRY_COLUMNS.

CREATE TABLE spatial_ref_sys
(
  srid integer NOT NULL,
  auth_name character varying(256),
  auth_srid integer,
  srtext character varying(2048),
  proj4text character varying(2048),
  CONSTRAINT spatial_ref_sys_pkey PRIMARY KEY (srid)
)
CREATE TABLE geometry_columns ( 
  f_table_catalog    VARRCHAR(256) NOT NULL, 
  f_table_schema     VARCHAR(256) NOT NULL,
  f_table_nam        VARCHAR(256) NOT NULL, 
  f_geometry_column  VARCHAR(256) NOT NULL, 
  coord_dimension    INTEGER NOT NULL, 
  srid               INTEGER NOT NULL, 
  type               VARCHAR(30) NOT NULL 
)

[编辑] template_postgis

template_postgis template database include PostGIS functions

create spatially-enabled databases

createdb -T template_postgis my_spatial_db
or
CREATE DATABASE my_spatial_db TEMPLATE=template_postgis 

[编辑] SRID

The OpenGIS specification also requires that the internal storage format of spatial objects include a spatial referencing system identifier (SRID). The SRID is required when creating spatial objects for insertion into the database.

[编辑] shp2pgsql

shp2pgsql - shapefile to postgis loader

The shp2pgsql data loader converts ESRI Shape files into SQL suitable for insertion into a PostGIS/PostgreSQL database.

examples:

shp2pgsql shaperoads roadstable roadsdb > roads.sql
psql -d roadsdb -f roads.sql
shp2pgsql shaperoads roadstable roadsdb | psql -d roadsdb

[编辑] 文档

[编辑] 链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱