se_generalize.sql 662 B

123456789101112131415161718
  1. -- This example demonstrates how to use the SE_Generalize function
  2. -- to remove unnecessary vertices from a geometry. This process is
  3. -- also known as "thinning". It can be used to clean up data, and
  4. -- it can also be used to reduce amount of data transmitted from the
  5. -- server to a client application which draws geometries.
  6. CREATE TABLE jagged_lines(line ST_LineString);
  7. INSERT INTO jagged_lines VALUES(
  8. "0 linestring(10 10, 20 20, 20 18, 30 30, 30 28, 40 40)"
  9. );
  10. -- Small threshold; no vertices removed:
  11. SELECT SE_Generalize(line, 0.5) FROM jagged_lines;
  12. -- Larger threshold; some vertices removed:
  13. SELECT SE_Generalize(line, 2) FROM jagged_lines;