File: simplify.sql

package info (click to toggle)
osmcoastline 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 812 kB
  • sloc: cpp: 2,834; sh: 659; sql: 199; makefile: 11
file content (21 lines) | stat: -rw-r--r-- 774 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--
--  simplify.sql
--
--  You can use this to simplify coastline polygons if needed.
--  It will only work properly if polygons are not split and
--  the 3857 projection is used (ie if osmcoastline was run with
--  "-m 0 -s 3857").
--

CREATE TABLE simplified_land_polygons (
    OGC_FID INTEGER PRIMARY KEY
);

SELECT AddGeometryColumn('simplified_land_polygons', 'GEOMETRY', 3857, 'POLYGON', 'XY', 1);

--  Depending on the detail you need you might have to change the numbers here.
--  The given numbers work up to about zoom level 9.
INSERT INTO simplified_land_polygons (ogc_fid, geometry) SELECT ogc_fid, SimplifyPreserveTopology(geometry, 300) FROM land_polygons WHERE ST_Area(geometry) > 300000;

SELECT CreateSpatialIndex('simplified_land_polygons', 'GEOMETRY');