From: Nicklas Avén Date: Fri, 3 Apr 2015 22:28:56 +0000 (+0000) Subject: Add ST_SimplifyVW X-Git-Tag: 2.2.0rc1~563 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd634bd7dc116bff8324b19a58ff9b0d7bfa6470;p=postgis Add ST_SimplifyVW git-svn-id: http://svn.osgeo.org/postgis/trunk@13418 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml index b747e3d59..8ded1792d 100644 --- a/doc/reference_processing.xml +++ b/doc/reference_processing.xml @@ -2737,7 +2737,55 @@ FROM (SELECT ST_Buffer('POINT(1 3)', 10,12) As the_geom) As foo; - + + + ST_SimplifyVW + Returns a "simplified" version of the given geometry using the Visvalingam-Whyatt algorithm + + + + + + geometry ST_SimplifyVW + geometry geomA + float tolerance + + + + + + Description + Returns a "simplified" version of the given geometry using the Visvalingam-Whyatt 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 that returned geometry might loose its + simplicity (see ) + Note topology may not be preserved and may result in invalid geometries. Use (see ) to preserve topology. + This function handles 3D and the third dimmension will affect the result + Availability: 2.2.0 + + + + Examples + A linestring that get the efffective area calculated. All points is returned since we give 0 as themin area threashold + + +select ST_AStext(ST_SimplifyVW(geom,30)) simplified +FROM (SELECT 'LINESTRING(5 2, 3 8, 6 20, 7 25, 10 10)'::geometry geom) As foo; +-result + simplified +-----------+-------------------+ +LINESTRING(5 2,7 25,10 10) + + + + + See Also + , , , Topology + + + ST_SetEffectiveArea Sets for each vertex point it's effective area, @@ -2750,32 +2798,34 @@ FROM (SELECT ST_Buffer('POINT(1 3)', 10,12) As the_geom) As foo; geometry ST_SetEffectiveArea geometry geomA float threashold = 0 + integer set_area = 1 Description - Sets for each vertex point it's effective area from Visvalingam’s algorithm. + Sets for each vertex point it's effective area from Visvalingam-Whyatt’s algorithm. The effective area is stored as the M-value of the geomtries. - If the second optional parameter is used, the resulting geometriy will be build obnly on vertex points with an effective area + If the second optional parameter is used, the resulting geometriy will be build only on vertex points with an effective area greater than or equal to that threashold value. That will be a simplified geometry. - + This function can be used for server side simplification by using the threashold. Another option is to not give any threashold value. Then you get the full geometry back, but with effective areas as M-values wich can be used by the client to simplify very fast. - + 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. + - This function handles 3D and the third dimmension will affect the effective area. Note that returned geometry might loose its simplicity (see ) Note topology may not be preserved and may result in invalid geometries. Use (see ) to preserve topology. The output geoemtry will loose all previous information in the M-values + This function handles 3D and the third dimmension will affect the effective area Availability: 2.2.0 @@ -2789,13 +2839,13 @@ FROM (SELECT 'LINESTRING(5 2, 3 8, 6 20, 7 25, 10 10)'::geometry geom) As foo; -result all_pts | thrshld_30 -----------+-------------------+ -LINESTRING M (5 2 1.79769313486232e+308,3 8 29,6 20 1.5,7 25 49.5,10 10 1.79769313486232e+308) | LINESTRING M (5 2 1.79769313486232e+308,7 25 49.5,10 10 1.79769313486232e+308) +LINESTRING M (5 2 3.40282346638529e+38,3 8 29,6 20 1.5,7 25 49.5,10 10 3.40282346638529e+38) | LINESTRING M (5 2 3.40282346638529e+38,7 25 49.5,10 10 3.40282346638529e+38) See Also - , , Topology + diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index bd52d2a6d..bd1758ff5 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -2910,7 +2910,13 @@ CREATE OR REPLACE FUNCTION ST_Simplify(geometry, float8) LANGUAGE 'c' IMMUTABLE STRICT; -- Availability: 2.2.0 -CREATE OR REPLACE FUNCTION ST_SetEffectiveArea(geometry, float8 default 0) +CREATE OR REPLACE FUNCTION ST_SimplifyVW(geometry, float8) + RETURNS geometry + AS 'MODULE_PATHNAME', 'LWGEOM_SetEffectiveArea' + LANGUAGE 'c' IMMUTABLE STRICT; + +-- Availability: 2.2.0 +CREATE OR REPLACE FUNCTION ST_SetEffectiveArea(geometry, float8 default 0, integer default 1) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_SetEffectiveArea' LANGUAGE 'c' IMMUTABLE STRICT;