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>226 / 310NoteGeography: For geography this is really a thin wrapper around the geometry implementation. It first determines thebest SRID that fits the bounding box of the 2 geography objects (if geography objects are within one half zone UTM butnot same UTM will pick one of those) (favoring UTM or Lambert Azimuthal Equal Area (LAEA) north/south pole, andfalling back on mercator in worst case scenario) and then intersection in that best fit planar spatial ref and retransformsback to WGS84 geography.ImportantDo not call with a GEOMETRYCOLLECTION as an argumentPerformed by the GEOS moduleAvailability: 1.5 support for geography data type was introduced.This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1. s2.1.1.3This method implements the SQL/MM specification. SQL-MM 3: 5.1.18ExamplesSELECT ST_AsText(ST_Intersection(’POINT(0 0)’::geometry, ’LINESTRING ( 2 0, 0 2 )’:: ←↪geometry));st_astext---------------GEOMETRYCOLLECTION EMPTY(1 row)SELECT ST_AsText(ST_Intersection(’POINT(0 0)’::geometry, ’LINESTRING ( 0 0, 0 2 )’:: ←↪geometry));st_astext---------------POINT(0 0)(1 row)---Clip all lines (trails) by country (here we assume country geom are POLYGON or ←↪MULTIPOLYGONS)-- NOTE: we are only keeping intersections that result in a LINESTRING or MULTILINESTRING ←↪because we don’t-- care about trails that just share a point-- the dump is needed to expand a geometry collection into individual single MULT* parts-- the below is fairly generic and will work for polys, etc. by just changing the where ←↪clauseSELECT clipped.gid, clipped.f_name, clipped_geomFROM (SELECT trails.gid, trails.f_name, (ST_Dump(ST_Intersection(country.the_geom, trails. ←↪the_geom))).geom As clipped_geomFROM countryINNER JOIN trailsON ST_Intersects(country.the_geom, trails.the_geom)) As clippedWHERE ST_Dimension(clipped.clipped_geom) = 1 ;--For polys e.g. polygon landmarks, you can also use the sometimes faster hack thatbuffering anything by 0.0-- except a polygon results in an empty geometry collection--(so a geometry collection containing polys, lines and points)-- buffered by 0.0 would only leave the polygons and dissolve the collection shell←↪

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

Saved successfully!

Ooh no, something went wrong!