12.07.2015 Views

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PostGIS</strong> <strong>1.5.8</strong> <strong>Manual</strong>16 / 310Chapter 4Using <strong>PostGIS</strong>: Data Management and Queries4.1 GIS ObjectsThe GIS objects supported by <strong>PostGIS</strong> are a superset of the "Simple Features" defined by the OpenGIS Consortium (OGC). Asof version 0.9, <strong>PostGIS</strong> supports all the objects and functions specified in the OGC "Simple Features for SQL" specification.<strong>PostGIS</strong> extends the standard with support for 3DZ,3DM and 4D coordinates.4.1.1 OpenGIS WKB and WKTThe OpenGIS specification defines two standard ways of expressing spatial objects: the Well-Known Text (WKT) form and theWell-Known Binary (WKB) form. Both WKT and WKB include information about the type of the object and the coordinateswhich form the object.Examples of the text representations (WKT) of the spatial objects of the features are as follows:• POINT(0 0)• LINESTRING(0 0,1 1,1 2)• POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))• MULTIPOINT(0 0,1 2)• MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))• MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))• GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4))The OpenGIS specification also requires that the internal storage format of spatial objects include a spatial referencing systemidentifier (SRID). The SRID is required when creating spatial objects for insertion into the database.Input/Output of these formats are available using the following interfaces:bytea WKB = ST_AsBinary(geometry);text WKT = ST_AsText(geometry);geometry = ST_GeomFromWKB(bytea WKB, SRID);geometry = ST_GeometryFromText(text WKT, SRID);For example, a valid insert statement to create and insert an OGC spatial object would be:INSERT INTO geotable ( the_geom, the_name )VALUES ( ST_GeomFromText(’POINT(-126.4 45.32)’, 312), ’A Place’);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!