5/4/16 18 Postgis Topology will replace Postgis SimpleFeature

Preview:

Citation preview

5/4/16 18Postgis Topology will replace Postgis SimpleFeature

Closed LineString where it is data

5/4/16 19Postgis Topology will replace Postgis SimpleFeature

Closed linestring where no data

On this layer : Postgis Topology → 5 points

: Postgis Simple Feature → 333105 (333100 duplicates) points

5/4/16 20Postgis Topology will replace Postgis SimpleFeature

Create s map with full coverage

Use Postgis Topology for line layers ?Intersecting nodes

Shared lines

5/4/16 22Postgis Topology will replace Postgis SimpleFeature

Change an exiting LineString, snap to crossing line

5/4/16 23Postgis Topology will replace Postgis SimpleFeature

Draw a LineString, no snap to

What about point layers and Postgis Topology ?

TopoJSON

5/4/16 25Postgis Topology will replace Postgis SimpleFeature

Postgis Topology and points

5/4/16 26Postgis Topology will replace Postgis SimpleFeature

So what is the end users reaction to just draw new lines ?

:-)Easy, faster, history kept, rollback changes

5/4/16 27Postgis Topology will replace Postgis SimpleFeature

Developer perspective using SimpleFeature

Weaknesses withSimpleFeature

● Duplication of lines

● Total replacement

● Mix of new and old points

● Bandwidth usage

5/4/16 28Postgis Topology will replace Postgis SimpleFeature

Development perspective move border when SimpleFeature

Simple Features and drifting points

5/4/16 30Postgis Topology will replace Postgis SimpleFeature

Drifting points

5/4/16 31Postgis Topology will replace Postgis SimpleFeature

Drifting points

14 Km off

Simple Features “equal”

DE-9IM : T*F**FFF*OR

II � ~IE � ~BE � ~EI � ~EB

SimpleFeature is not using the relationalfeatures of Postgres.

Postgis Topology is using the relationalfeatures of Postgres.

Development perspective And

Postgis Topology

5/4/16 35Postgis Topology will replace Postgis SimpleFeature

Develop

perspective

using

Postgis

Topology

Slide from: http://strk.keybit.net/projects/postgis/Paris2011_TopologyWithPostGIS_2_0.pdf

5/4/16 36Postgis Topology will replace Postgis SimpleFeature

ApacheTomcat

Java app

pgtopo_update_sqlPostgis Topology

GeoJSON

TopoJSON

GeoJSON

TopoJSON/Ids

System overview for the update client

5/4/16 37Postgis Topology will replace Postgis SimpleFeature

Development GitLab, GitHub, Continues Integration

deploy_war_utv: stage: deploy script: - mvn package tomcat7:redeploy -Pkartupd01utv only: - develop deploy_war_test: stage: deploy script: - mvn package tomcat7:redeploy -Pkartupd01test only: - test

Running inside Postgres

5/4/16 38Postgis Topology will replace Postgis SimpleFeature

pgtopo_update_sql

Postgis Topology

● pgtopo_update_sql

uses

Postgis Topology

to check and

adjust result

https://github.com/NibioOpenSource/pgtopo_update_sql

“developed with very good help from Sandro Santilli”

● Postgis Topology package handles the postgis operations

5/4/16 39Postgis Topology will replace Postgis SimpleFeature

pgtopo_update_sql● Called from Java by using stored proc

Postgis Topology

5/4/16 40Postgis Topology will replace Postgis SimpleFeature

pgtopo_update_sql Partly developed as a part of a map update project

● Focus have been this projects used cases ● Needs redesign, but it works for this project ● The update method need a redesign● Have lot of tests that help us

5/4/16 41Postgis Topology will replace Postgis SimpleFeature

Development perspective move border with Postgis Topology

Only new linesfrom client

to

Server

Postgis Topology means

- no drifting points- easier to undo

fkey1 = fkey2Postgis Topology benefits

both end user and developer when workingon surface and line layers.

Postgis Topology

- tested with one billion pointshttp://www.slideshare.net/laopsahl/foss4-g-topologyjuly162015

- seems to be solid and few errors

5/4/16 45Postgis Topology will replace Postgis SimpleFeature

{"type":"Topology","objects":{"collection":{"type":"GeometryCollection","geometries":[{"type":"Polygon","properties":{"id":520},"arcs":[[-1]]}]}},"arcs":[[[9717,419],[-1126,-419],[-5070,958],[-2113,898],[-1126,2036],[422,2335],[-704,2754],[1972,1018],[2253,0],[1267,-419],[1409,-1437],[3098,-6467],[-282,-1257]]],"transform":{"scale":[0.007100710071007101,0.016701670167016704],"translate":[1088433,7800262]}}

● GeoJSON 7.6 MB

● TopoJSON 1.3 MB

● 80 % reduction

What is TopoJSON ?

5/4/16 46Postgis Topology will replace Postgis SimpleFeature

Reduced client network bandwidth

known and fixed bandwidth

5/4/16 47Postgis Topology will replace Postgis SimpleFeature

ST_Simplify perfect works best Postgis Topology

7990316 bytes 149400 byte (98 % less)

5/4/16 48Postgis Topology will replace Postgis SimpleFeature

ST_Simplify gives you a good overview with less points

7990316 bytes 149400 byte (98 % less)

5/4/16 49Postgis Topology will replace Postgis SimpleFeature

ST_Simplify and Simple Feature Using Topology

common border will not match. No problem

5/4/16 50Postgis Topology will replace Postgis SimpleFeature

ST_Simplify and line layers with Topolgy

GeoServer , MapServer and Postgis Topology

5/4/16 52Postgis Topology will replace Postgis SimpleFeature

So what is the end developer reaction Using Postgis Topology ?:-)

Postgis Topology fits new data in to current map.(no id problem, no data lost, no duplication,less data,

faster development time)

IF “YOU NEED SIMPLE USER INTERFACE FOR MAPS UPDATE” AND“MAPS OF HIGH QUALITY”

THENUSE POSTGIS TOPOLOGY

ELSEUSE WHATEVER YOU LIKE

END IF;

Hopefully at next FOSS4G Postgis Topology will be a main themewith workshops many talks.

Thanks for your attention Lars.Opsahl@nibio.no

Recommended