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>187 / 310NoteThis function call will automatically include a bounding box comparison that will make use of any indexes that areavailable on the geometries.NotePrior to 1.3, ST_Expand was commonly used in conjunction with && and ST_Distance to achieve the same effect andin pre-1.3.4 this function was basically short-hand for that construct. From 1.3.4, ST_DWithin uses a more short-circuitdistance function which should make it more efficient than prior versions for larger buffer regions.This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1.Availability: 1.5.0 support for geography was introducedExamples--Find the nearest hospital to each school--that is within 3000 units of the school.-- We do an ST_DWithin search to utilize indexes to limit our search list-- that the non-indexable ST_Distance needs to process--If the units of the spatial reference is meters then units would be metersSELECT DISTINCT ON (s.gid) s.gid, s.school_name, s.the_geom, h.hospital_nameFROM schools sLEFT JOIN hospitals h ON ST_DWithin(s.the_geom, h.the_geom, 3000)ORDER BY s.gid, ST_Distance(s.the_geom, h.the_geom);--The schools with no close hospitals--Find all schools with no hospital within 3000 units--away from the school. Units is in units of spatial ref (e.g. meters, feet, degrees)SELECT s.gid, s.school_nameFROM schools sLEFT JOIN hospitals h ON ST_DWithin(s.the_geom, h.the_geom, 3000)WHERE h.gid IS NULL;See AlsoST_Distance, ST_Expand7.8.19 ST_EqualsST_Equals — Returns true if the given geometries represent the same geometry. Directionality is ignored.Synopsisboolean ST_Equals(geometry A, geometry B);DescriptionReturns TRUE if the given Geometries are "spatially equal". Use this for a ’better’ answer than ’=’. Note by spatially equal wemean ST_Within(A,B) = true and ST_Within(B,A) = true and also mean ordering of points can be different but represent the samegeometry structure. To verify the order of points is consistent, use ST_OrderingEquals (it must be noted ST_OrderingEquals isa little more stringent than simply verifying order of points are the same).

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

Saved successfully!

Ooh no, something went wrong!