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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PostGIS</strong> <strong>1.5.8</strong> <strong>Manual</strong>19 / 310The basis for the <strong>PostGIS</strong> geometry type is a plane. The shortest path between two points on the plane is a straight line. Thatmeans calculations on geometries (areas, distances, lengths, intersections, etc) can be calculated using cartesian mathematics andstraight line vectors.The basis for the <strong>PostGIS</strong> geographic type is a sphere. The shortest path between two points on the sphere is a great circle arc.That means that calculations on geographies (areas, distances, lengths, intersections, etc) must be calculated on the sphere, usingmore complicated mathematics. For more accurate measurements, the calculations must take the actual spheroidal shape of theworld into account, and the mathematics becomes very complicated indeed.Because the underlying mathematics is much more complicated, there are fewer functions defined for the geography type thanfor the geometry type. Over time, as new algorithms are added, the capabilities of the geography type will expand.One restriction is that it only supports WGS 84 long lat (SRID:4326). It uses a new data type called geography. None of theGEOS functions support this new type. As a workaround one can convert back and forth between geometry and geography types.The new geography type uses the PostgreSQL 8.3+ typmod definition format so that a table with a geography field can be addedin a single step. All the standard OGC formats except for curves are supported.4.2.1 Geography BasicsThe geography type only supports the simplest of simple features. Standard geometry type data will autocast to geography if itis of SRID 4326. You can also use the EWKT and EWKB conventions to insert data.• POINT: Creating a table with 2d point geometry:CREATE TABLE testgeog(gid serial PRIMARY KEY, the_geog geography(POINT,4326) );Creating a table with z coordinate pointCREATE TABLE testgeog(gid serial PRIMARY KEY, the_geog geography(POINTZ,4326) );• LINESTRING• POLYGON• MULTIPOINT• MULTILINESTRING• MULTIPOLYGON• GEOMETRYCOLLECTIONThe new geography fields don’t get registered in the geometry_columns. They get registered in a new view called geography_columnswhich is a view against the system catalogs so is always automatically kept up to date without need for an AddGeom...like function.Now, check the "geography_columns" view and see that your table is listed.You can create a new table with a GEOGRAPHY column using the CREATE TABLE syntax. Unlike GEOMETRY, there is noneed to run a separate AddGeometryColumns() process to register the column in metadata.CREATE TABLE global_points (id SERIAL PRIMARY KEY,name VARCHAR(64),location GEOGRAPHY(POINT,4326));Note that the location column has type GEOGRAPHY and that geography type supports two optional modifier: a type modifierthat restricts the kind of shapes and dimensions allowed in the column; an SRID modifier that restricts the coordinate referenceidentifier to a particular number.

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

Saved successfully!

Ooh no, something went wrong!