+ All Categories
Home > Documents > Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different...

Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different...

Date post: 30-Nov-2018
Category:
Upload: dangdung
View: 217 times
Download: 0 times
Share this document with a friend
22
Skeletonizing Polygons Using PostGIS
Transcript
Page 1: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Skeletonizing PolygonsUsing PostGIS

Page 2: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

● Vegetation Layer

DATA SET

● Water data extracted

1:150,000

● Snake River

Page 3: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

PreviousSimplification Results

Original

Different Algorithms = Different Results

Mapshaper 0.7%

1:150,000

QGIS, PostGIS, OpenJump

Douglas-Peucker Algorithm Visvalingam Algorithm

Page 4: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

THE GOAL

Extract the center line of a river from a polygon data set

1:34,000

Page 5: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Tools

GRASS GIS

QGIS

Page 6: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

PostGIS/SFCGAL

SFCGAL is a C++ wrapper library around CGAL that provides 2D and 3D geometric functions.

CGAL = The Computational Geometry Algorithms Library

PostGIS is a spatial database extender for PostgreSQL object-relational database.

Page 7: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

2D Straight Skeleton and Polygon Offsetting

The straight skeleton of a polygon is defined by a continuous shrinking process in which the edges of the polygon are moved inwards parallel to themselvesat a constant speed.

As the edges move in this way, the vertices where pairsof edges meet also move.

If one of these moving vertices collides with a nonadjacentedge, the polygon is split in two by the collision.The straight skeleton is the set of curves traced out by the moving vertices in this process.

Page 8: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

ST_StraightSkeleton — Compute a straight skeleton from a geometry

CREATE TABLE snake_partskeleton AS SELECT st_straightskeleton(snake_part.wkb_geometry) AS wkb_geometry FROM snake_part;

ALTER TABLE snake_partskeleton OWNER TO postgres;GRANT ALL ON TABLE snake_partskeleton TO postgres;GRANT SELECT ON TABLE snake_partskeleton TO pgselectonly;

Page 9: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Output Problem: Need to get rid of the dangles

Page 10: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

1. PostGIS - negative buffer and st_crosses

2. GRASS GIS – remove dangles

Possible Solutions

Page 11: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

PostGIS negative buffer and st_crosses

Page 12: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker
Page 13: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

PostGIS negative buffer and st_crosses

Page 14: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Increase buffer – loose parts

Page 15: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Using simplified polygon layer

Page 16: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

GRASS GIS via QGIS

Page 17: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Tool = v.clean.rmdangle

A line/boundary is considered to be a dangle if no other line of given type is on at least one end node.

The rmdangle tool deletes a dangle if the length is shorter than thresh or thresh < 0.

Page 18: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Threshold = 200'Threshold = 100'

Page 19: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Threshold = 200'Threshold = 100'

Using simplified polygon layer

Page 20: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Remember THE GOALExtract the center line of a river from a

polygon data set

PostGIS

GRASS

simplified polygon

simplified polygon

Page 21: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Next Steps

● ST_ApproximateMedialAxis● Use to create a stream flow

network?● Use for labeling purposes on

maps and mapserver

Page 22: Skeletonizing Polygons Using PostGIS · Previous Simplification Results Original Different Algorithms = Different Results Mapshaper 0.7% 1:150,000 QGIS, PostGIS, OpenJump Douglas-Peucker

Questions?

Angie Rudolph, GISP

[email protected]


Recommended