Sei sulla pagina 1di 2

PostGIS 1.5.

1 Manual
237 / 315

Synopsis
geometry ST_Shift_Longitude(geometry geomA);

Description
Reads every point/vertex in every component of every feature in a geometry, and if the longitude coordinate is <0, adds 360 to it.
The result would be a 0-360 version of the data to be plotted in a 180 centric map

Note
This is only useful for data in long lat e.g. 4326 (WGS 84 long lat)

Pre-1.3.4 bug prevented this from working for MULTIPOINT. 1.3.4+ works with MULTIPOINT as well.
This function supports 3d and will not drop the z-index.

Examples
--3d points
SELECT ST_AsEWKT(ST_Shift_Longitude(ST_GeomFromEWKT(SRID=4326;POINT(-118.58 38.38 10)))) As geomA,
ST_AsEWKT(ST_Shift_Longitude(ST_GeomFromEWKT(SRID=4326;POINT(241.42 38.38 10)))) As geomb
geomA
geomB
-------------------SRID=4326;POINT(241.42 38.38 10) SRID=4326;POINT(-118.58 38.38 10)
--regular line string
SELECT ST_AsText(ST_Shift_Longitude(ST_GeomFromText(LINESTRING(-118.58 38.38, -118.20
38.45))))
st_astext
---------LINESTRING(241.42 38.38,241.8 38.45)

See Also
ST_GeomFromEWKT, ST_GeomFromText, ST_AsEWKT

7.9.16 ST_Simplify
Name
ST_Simplify Returns a "simplified" version of the given geometry using the Douglas-Peuker algorithm.

Synopsis
geometry ST_Simplify(geometry geomA, float tolerance);

PostGIS 1.5.1 Manual


238 / 315

Description
Returns a "simplified" version of the given geometry using the Douglas-Peuker algorithm. Will actually do something only
with (multi)lines and (multi)polygons but you can safely call it with any kind of geometry. Since simplification occurs on a
object-by-object basis you can also feed a GeometryCollection to this function.

Note
Note that returned geometry might loose its simplicity (see ST_IsSimple)

Note
Note topology may not be preserved and may result in invalid geometries. Use (see ST_SimplifyPreserveTopology) to
preserve topology.

Performed by the GEOS module.


Availability: 1.2.2

Examples
A circle simplified too much becomes a triangle, medium an octagon,

SELECT ST_Npoints(the_geom) As np_before, ST_NPoints(ST_Simplify(the_geom,0.1)) As np01_notbadcircle, ST_NPoints(ST_Simplify(the_geom,0.5)) As np05_notquitecircle,


ST_NPoints(ST_Simplify(the_geom,1)) As np1_octagon, ST_NPoints(ST_Simplify(the_geom,10)) As np10_triangle,
(ST_Simplify(the_geom,100) is null) As np100_geometrygoesaway
FROM (SELECT ST_Buffer(POINT(1 3), 10,12) As the_geom) As foo;
-result
np_before | np01_notbadcircle | np05_notquitecircle | np1_octagon | np10_triangle | np100_geometrygoesaway
-----------+-------------------+---------------------+-------------+---------------+----------------49 |

33 |

17 |

9 |

4 | t

See Also
ST_IsSimple, ST_SimplifyPreserveTopology

7.9.17 ST_SimplifyPreserveTopology
Name
ST_SimplifyPreserveTopology Returns a "simplified" version of the given geometry using the Douglas-Peuker algorithm. Will
avoid creating derived geometries (polygons in particular) that are invalid.

Synopsis
geometry ST_SimplifyPreserveTopology(geometry geomA, float tolerance);

Potrebbero piacerti anche