Towards an area datatype for OSM - State of the Map 2013

Preview:

DESCRIPTION

*** Presented by Jochen Topf at State of the Map 2013 *** For the video of this presentation please see http://lanyrd.com/2013/sotm/scpkrr/ *** Full schedule available at http://wiki.openstreetmap.org/wiki/State_Of_The_Map_2013 OpenStreetMap currently does not have a polygon or area data type. Instead areas are usually modelled as closed ways or multipolygon relations (plus some other approaches for special cases). This diversity in solutions for essentially the same problem makes editing and using OSM data much harder than it needs to be. Especially multipolygon relations are difficult to work with and they are quite brittle, leading to a lot of broken data in OSM. The talk will show the problems we currently have when editing and using OSM data. It will describe approaches for a solution with their advantages and disadvantages and the changes necessary to the core database, editors, and applications using OSM data.

Citation preview

Towards an Area Datatypefor OSM

JochenTopf

Fundamental Geometry Types

Point Linestring Polygon

Point Linestring Polygon

Node Way ??

Polygon with Holes

1 outer ring, 2 inner rings

Multipolygon

2 outer rings, 2 inner rings

Definition

A polygondevides

the surface of the planetinto

two regions:

inside - outside

Definition

A polygon is usually described by its border.

The border is a bunch of lines that never intersect.

Border line direction?

Definition

A polygon is usually described by its border.

The border is a bunch of lines that never intersect.

Border line direction?

Polygons in OSM:

There Is More Than One WayTo Do It!

Polygon Type #1:Closed way

Polygon Type #1:Closed way

No holesDepends on tags...

Polygon Type #1:Closed way

highway=residential natural=wood

Linestring or polygon or maybe both...

Polygon Type #1:area=yes

highway=pedestrian highway=pedestrian area=yes

Polygon Type #2:Multipolygon Relation

type=multipolygon

Polygon Type #2:Multipolygon Relation

type=multipolygon

Can have multiple inner and outer rings.

Polygon Type #3:Boundary Relation

type=boundary

Polygon Type #3:Boundary Relation

type=boundary

Role: subarea !

Polygon Type #4:Coastline

Ways connected end-to-end.Land always on left, water always on right.

Polygon Type #5:Riverbank

waterway=riverbank

Polygon Type #5:Riverbank

waterway=riverbank

Polygon Type #5:Riverbank

waterway=riverbank

Types of Polygons

#1 Closed Ways#2 Multipolygon Relation

#3 Boundary Relation#4 Coastlines#5 Riverbanks

Problems

Which polygon type to use?(lakes?, rivers?, boundaries?)

What if several typesare in use at the same time?

Converting from one to another?

Problems withMultipolygon Relations

Tags on relation + outer ways + inner ways

Broken geometries (Self-intersections, ...)

Inner/outer mixups

Subareas

Broken Multipolygon Relations

About 2% broken, another 2% warnings

Polygons in OSM are...

difficult to understand,diffcult to edit,difficult to use .

Some Numbers...

110 million (closed way) polygons 90 million are buildings 72 million have 6 points or less

900,000 area=yes 750,000 natural=coastline (31 million nodes) 260,000 waterway=riverbank

Relations

1,000,000 type=multipolygon 200,000 type=boundary

For together >2 million (multi-)polygons

1,100,000 landuse/natural=* 240,000 boundary=administrative

Largest multipolygon 300,000 points

What are we going to do about it?

A NewArea

Datatype

What Should it Look Like?

Referencing nodes? (Like a way?)(What about huge areas?)

Referencing ways? (A bit like MP relations?)(What about small areas?)

Not referencing anything, coordinates inside?(Like Simple Feature)

Polygons are Problematic...

1. Because there are several ways to accomplish the same thing.

2. Because they are hard to edit and keep valid.

Polygons are Problematic...

1. Because there are several ways to accomplish the same thing.

→ One area datatype

2. Because they are hard to edit and keep valid.

Polygons are Problematic...

1. Because there are several ways to accomplish the same thing.

→ One area datatype

2. Because they are hard to edit and keep valid.

→ Let the computer do the checking

Validation

On the serverIn the editor

Lightweight!?

Check only changes!

Partial download

Check locally

API

Full download of areas not always possible!

Download parts of areas in bbox+

Upload changes of areas in bbox

I think this is doable!

*Details are left as an exercisefor the reader.

Migration

1. Add support for new area type

2. Convert some areas automatically

3. Convert rest manually

4. Remove support for old areas

Thanks!

http://wiki.osm.org/wiki/The_Future_of_Areas

Jochen Topfjochen@topf.orgjochentopf.com

Recommended