[postgis-tickets] [SCM] PostGIS; Spatial objects for PostgreSQL. branch master updated. 191568eaf59c60c89e229ad3f09efcc7c41887e7
git at osgeo.org
git at osgeo.org
Wed Oct 30 01:41:29 PDT 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS; Spatial objects for PostgreSQL.".
The branch, master has been updated
via 191568eaf59c60c89e229ad3f09efcc7c41887e7 (commit)
from 492922a8c2fe83b2b68a9540a1699c4aaea3da88 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 191568eaf59c60c89e229ad3f09efcc7c41887e7
Author: Sandro Santilli <strk at kbt.io>
Date: Wed Oct 30 09:40:07 2019 +0100
Drop the "Installing Geography Extension" section from geography docs
The geography type is part of core since 1.5.0
diff --git a/doc/geography.txt b/doc/geography.txt
index 976e6f0..0342683 100644
--- a/doc/geography.txt
+++ b/doc/geography.txt
@@ -1,7 +1,7 @@
Introduction to the Geography Type
==================================
-The geography type provides native support for spatial features represented on "geographic" coordinates (sometimes called "geodetic" coordinates, or "lat/lon", or "lon/lat"). Geographic coordinates are spherical coordinates expressed in angular units (degrees).
+The geography type provides native support for spatial features represented on "geographic" coordinates (sometimes called "geodetic" coordinates, or "lat/lon", or "lon/lat"). Geographic coordinates are spherical coordinates expressed in angular units (degrees).
The basis for the PostGIS geometry type is a plane. The shortest path between two points on the plane is a straight line. That means calculations on geometries (areas, distances, lengths, intersections, etc) can be calculated using cartesian mathematics and straight line vectors.
@@ -29,7 +29,7 @@ The text representations for geography objects are the same as for geometries:
* POINT(0 0)
* LINESTRING(0 0, 1 1)
-* POLYGON((0 0, 1 0, 1 1, 1 0, 0 0))
+* POLYGON((0 0, 1 0, 1 1, 1 0, 0 0))
* ..etc..
The coordinates for geography objects are expected to be in decimal degrees, with longitude as the first ordinate and latitude as the second:
@@ -39,34 +39,6 @@ The coordinates for geography objects are expected to be in decimal degrees, wit
The geography implementation currently assumes that all coordinates are relative to the WGS84 spheroid (using an SRID of 4326), and does not allow any other SRID values to be used. Future enhancements may allow multiple spheroids to be supported and transformations between spheroids. An SRID value of 0 (undefined) will be treated as implicitly using WGS84 (4326).
-
-Installing the Geography Extension
-==================================
-
-* Pull the source from the geography sandbox.
-
- svn checkout http://svn.osgeo.org/postgis/spike/pramsey/geodetic postgis-geodetic-svn
-
-* Compile and install PostGIS as usual.
-
- cd postgis-geodetic-svn
- ./configure
- make
- make install
-
-* Then, create a database and install PostGIS into that database. (Assuming your PostgreSQL is installed in /usr/local/pgsql.)
-
- createdb geography
- psql geography < /usr/local/pgsql/share/contrib/postgis.sql
- psql geography < /usr/local/pgsql/share/contrib/spatial_ref_sys
-
-* Then, install the geography extension.
-
- psql geography < /usr/local/pgsql/share/contrib/geography.sql
-
-* That's it!
-
-
Creating a Geography Table
==========================
@@ -77,31 +49,31 @@ You can create a geography-enabled table using the CREATE TABLE statement as fol
Check out the contents of "gtable":
\d gtable
-
+
Table "public.gtable"
- Column | Type | Modifiers
+ Column | Type | Modifiers
--------+-----------+-----------
id | integer | not null
- geog | geography |
+ geog | geography |
Indexes:
"gtable_pkey" PRIMARY KEY, btree (id)
-
-
+
+
Now, check the "geography_columns" view and see that your table is listed:
SELECT * FROM geography_columns;
-
+
Note that "geography_columns" metadata is a view against the system tables and kept up to date automatically. This is a big improvement on the manually maintained "geometry_columns" table.
Insert some data into the table and then pull it out:
INSERT INTO gtable1 VALUES (1, 'POINT(0 0)');
SELECT id,ST_AsText(geog) FROM gtable2;
-
+
Try inserting some invalid geography data and see the database complain:
INSERT INTO gtable1 values (1, 'POINT(1000 0)');
-
+
Using Type Restrictions
=======================
@@ -109,32 +81,32 @@ Using Type Restrictions
You can restrict the geography types allowed in a column by adding a type restriction when you create the table:
CREATE TABLE gtable2 ( id integer, geog geography(linestring) );
-
+
\d gtable2
-
+
Table "public.gtable2"
- Column | Type | Modifiers
+ Column | Type | Modifiers
--------+-----------------------+-----------
- id | integer |
- geog | geography(LineString) |
-
+ id | integer |
+ geog | geography(LineString) |
+
Now, if you try to insert a point, the database will complain:
INSERT INTO gtable2 VALUES (1, 'POINT(0 0)');
-
+
You can also add SRID restrictions to a column, though at this point (with only one SRID supported) there is not a lot of utility to the feature:
CREATE TABLE gtable3 ( id integer, geog geography(polygon, 4326) );
-
+
\d gtable3
-
+
Table "public.gtable3"
- Column | Type | Modifiers
+ Column | Type | Modifiers
--------+-------------------------+-----------
- id | integer |
- geog | geography(Polygon,4326) |
-
+ id | integer |
+ geog | geography(Polygon,4326) |
+
Using Input/Output Functions
@@ -150,7 +122,7 @@ There are only four input/output functions at this time supporting the OGC well-
You can test that they are bi-directional by stringing them together:
SELECT ST_AsText(ST_GeographyFromBinary(ST_AsBinary(ST_GeographyFromText('LINESTRING(0 0, 1 1)'))));
-
+
Casting from Geometry
=====================
@@ -161,5 +133,5 @@ There is currently a simple cast from geometry to geography, which can be useful
INSERT INTO geomtable VALUES ( 2, 'POINT(0 0)' );
CREATE TABLE geogtable AS SELECT id, geom::geography AS geog FROM geomtable;
SELECT ST_AsText(geog), id FROM geogtable;
-
+
-----------------------------------------------------------------------
Summary of changes:
doc/geography.txt | 78 ++++++++++++++++++-------------------------------------
1 file changed, 25 insertions(+), 53 deletions(-)
hooks/post-receive
--
PostGIS; Spatial objects for PostgreSQL.
More information about the postgis-tickets
mailing list