PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial...

49
PostGIS: future developments

Transcript of PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial...

Page 1: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

PostGIS: future developments

Page 2: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

What is PostGIS

● GPL PostgreSQL extension for Geographic Objects● Types● Operators● Functions● Indexes● Standard interfaces● Extension API

Page 3: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

Current features

✔ OpenGIS “Simple Features for SQL” certified✔ Spatial analysis and predicates (GEOS/JTS)✔ Up to 4 dimensions coordinates (Shapefile-like)✔ 2d spatial indexing (rtree/GiST)✔ SRS reprojections (PROJ4)✔ About 200 spatial functions✔ Lossless Shapefile import / export

Page 4: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

current features

OGC types

1. Points

2. Lines

3. Polygons

4. MultiPoints

5. MultiLines

6. MultiPolygons

7. Collections

Page 5: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

current features

Spatial analysis

✔ Union✔ Intersection✔ Difference✔ Symmetric difference✔ Convex Hull✔ Buffer

Page 6: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

current features

Spatial predicates

✔ Equals✔ Disjoint✔ Intersects✔ Touches✔ Crosses✔ Within✔ Contains✔ Overlaps

Page 7: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

current features

Coordinate dimensions✔ 2D ( X, Y )✔ 2.5D ( X, Y, Z )✔ Measured ( X, Y, M )✔ Measured 2.5D ( X, Y, Z, M )

LosslessShapefile

import / export

Page 8: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

Community

● MapServer● GeoServer● UDIG● Qgis● Jump● OpenEV● GRASS● OGR

● GeoTypes● GeoTools● MezoGIS● Thuban● phpPgGis● PrimaGIS● OrbisCAD● ...

Page 9: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

Ongoing and future developments

● Long transactions● Topology● Networks● Rasters● ISO SQL/MM

Page 10: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

ongoing development

Long transactions

● Features locking● Implemented in 1.1.3● OGC standard (WFS)

Page 11: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

long transactions

What for ?

● OGC Web Features Service● Generic web-based architectures● Data integrity● Concurrent access

Page 12: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

long transactions

How does it work

● Lock any database row (not only features)● The lock is bound to an authentication token● Add auth tokens to your session● Do your things● Unlock the row(s)

Page 13: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

long transactions

How does it work

● Locks are stored inside the DBMS● Protection is implemented using triggers● No middleware involved● Every application is prevented from altering a

locked row

Page 14: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

ongoing development

Topology

● Normalized spatial data● Drafted since 1.1.0● ISO standard

(SQL/MM)

Page 15: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Why ?

● Topological integrity● Reduced storage size● Spatial analysis

Page 16: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

why topology ?

Topological integrity

● Every intersection is a node

Page 17: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

why topology ?

Topological integrity

● Every intersection is a node

Page 18: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

why topology ?

Topological integrity

● Edges are shared ...

Page 19: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

why topology ?

Topological integrity

● ... not separate entities.

Page 20: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

why topology ?

Reduced storage size

● Every edge is stored only once

Page 21: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

why topology ?

Spatial analysis

● Spatial relationships are part of the model● Predicates and overlays using standard SQL● Do they touch ? YES ! (no starvation)

Page 22: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

What do we have

● Draft included in PostGIS 1.1.0● Conceptual schema● Physical schema (ISO SQL/MM)● Functions (ISO SQL/MM)

Page 23: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Conceptual model

● Faces, Edges and Nodes

Page 24: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Conceptual model

● Topo-geometries

Page 25: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Conceptual model

● Layers

Page 26: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topologyConceptual model

Page 27: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Physical model

● PostgreSQL 7.3 or up required● All routines, types and other management objects

are stored in the "topology" schema● Topologies are stored in schemas● TopoGeometry type● Layers metadata

Page 28: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Metadata tables

● topology.topology● topology.layer

Page 29: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Topology schema

● <name>.edge● <name>.face● <name>.node● <name>.relation (TopoGeometry comp.)

Page 30: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Functions

● Create/destroy topologies● Edit topologies● Validate topologies● Define layers (simple and hierarchical)● Define TopoGeometries (simple and hierarchical)● Cast TopoGeometries to Geometries

Page 31: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Example: loading a topology

SELECT topology.CreateTopology('mytopo');

Page 32: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Example: loading a topology

INSERT INTO mytopo.face(face_id) VALUES(1); -- F1

Page 33: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Example: loading a topology

INSERT INTO mytopo.node VALUES(1, 'POINT(0 0)', NULL); -- N1

INSERT INTO mytopo.node VALUES(2, 'POINT(0 30)', NULL); -- N2

INSERT INTO mytopo.node VALUES(3, 'POINT(30 30)', NULL); -- N3

Page 34: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Example: loading a topologyINSERT INTO mytopo.edge VALUES(1, 1, 2, -3, 2, 0, 1, 'LINESTRING(0 0, 0 30)'); -- E1

INSERT INTO mytopo.edge VALUES(2, 2, 3, -1, 3, 0, 1, 'LINESTRING(0 30, 30 30)'); -- E2

INSERT INTO mytopo.edge VALUES(3, 3, 1, -2, 1, 0, 1, 'LINESTRING(30 30, 0 0)'); -- E3

Page 35: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Example: validating a topology

SELECT * FROM topology.ValidateTopology ('mytopo');

error | id1 | id2 -------+-----+-----(0 rows)

Page 36: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Example: defining a TopoGeometry

CREATE TABLE land_parcels (feature_name VARCHAR);

-- Returns TG_LAYER_IDSELECT AddTopoGeometryColumn('mytopo', 'public', 'land_parcels', 'feature', 'POLYGON');

INSERT INTO features.land_parcels VALUES ('P1', -- Feature name topology.CreateTopoGeom( 'mytopo', -- Topology name 3, -- Topology geometry type (polygon/multipolygon) 1, -- TG_LAYER_ID for this topology (from topology.layer) '{{1,3}}') -- face_id:1 );

Page 37: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

topology

Missing features

● ISO SQL/MM topology editing functions are incomplete (can still use standard SQL)

● TIGER/Line loader dumper (possible at this stage)

● Geometry => TopoGeometry● Interface cleanups

Page 38: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

future developments

Network

● Shortest path● Cartoweb● ISO standard

(SQL/MM)

Page 39: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

network

Why ?

● Communication networks modeling● Standardized interface● Common algorithms

Page 40: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

network

What would it be ?

● A schema and a set of functions● Like Topology model● Nodes, Links (vs. edges), No faces

Page 41: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

network

Current status

● Unimplemented :)

Page 42: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

future developments

Rasters

● DBMS vs. filesystem● Imagery or analysis ?● Standards ?● Use cases ?

Page 43: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

rasters

Why ?

● Unified access● Relational model (metadata)● SQL interface● Transactional integrity● Raster cells analysis

Page 44: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

rasters

Why not ?

● File formats already indexed● Easier disaster recovery● Don't use DBMS as filesystems :)● Rasters on disk and metadata in DBMS● I/O overhead (blobs?)

Page 45: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

rasters

Possible data models

● Blocks (values are blocks)– existing implementations (ie. GEORASTER)

● Wrapped-blob (values are file handlers)– reduced I/O overhead

– no need to define yet another file format

● Fully relational (values are single pixels)– quick & easy

– scalability & performance limits

Page 46: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

rasters

What do we have

● The CHIP type (could become a BLOCK type)● PgCHIP gdal driver● An implementation of the “fully relational”

model● A community pushing for it :)

Page 47: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

future developments

ISO SQL/MM

● Signatures● New types● (Topology)● (Networks)

Page 48: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

ISO SQL/MM

Types

● Instantiable subtypes● CircularString● CompoundCurve● CurvePolygon● MultiCurve● Surface● MultiSurface

Page 49: PostGIS: future developmentsCurrent features OpenGIS “Simple Features for SQL” certified Spatial analysis and predicates (GEOS/JTS) Up to 4 dimensions coordinates (Shapefile-like)

That's all, folks !

Questions ?