things to do with openstreetmap

48
#foss4g13, Nottingham, Sept. 19th THINGS TO DO THINGS TO DO WITH WITH OPENSTREETMAP OPENSTREETMAP

Upload: lluis-vicens

Post on 09-May-2015

1.013 views

Category:

Technology


7 download

DESCRIPTION

This study of the things we can do using OpenStreetMap arises from SIGTE's need, as a service within the University of Girona, to offer the university community new cartographic services based on free data and, more specifically, on OpenStreetMap, from the elaboration of paper maps to computer applications like the publication of maps, the rendering of custom layers, routing, etc. In this presentation we will examine the possibilities offered by OpenStreetMap and the main tools allowing one to operate with this data

TRANSCRIPT

Page 1: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

THINGS TO DO THINGS TO DO WITH WITH

OPENSTREETMAPOPENSTREETMAP

Page 2: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

OverviewOverview1. Available Data Sources and Download options

2. Data Processing and Edition

3. Creating maps on the web

4. Database import

5. Rendering and Styling

6. Routing

7. Advanced Tools

Page 3: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

ObjectiveObjective

Detect and summarize the different existing options, and potential applications using OSM data.

Detect of new services and applications to be offered to the university community

Page 4: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#1.1 Basic Available #1.1 Basic Available Data Sources & Data Sources &

DownloadDownload

a) Planet OSMa) Planet OSM

b) History

c) Diff. files

Page 5: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

a) Planet OSMa) Planet OSM

A single file29 Gb

“All the nodes, ways and relations that make up your

map”

Weekly updatedPBF or OSM XML

Page 6: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

a) Planet OSMa) Planet OSM

Page 7: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#1.1 Basic Available #1.1 Basic Available Data Sources & Data Sources &

DownloadDownload

a) Planet OSMa) Planet OSM

b) Historyb) History

c) Diff. files

Page 8: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

b) Historyb) History

A single file>39 Gb

“Full editing history of the OSM Database”

Monthly/Yearly updatedLatest: 08-feb-2013

Page 9: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

b) Historyb) History

Page 10: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#1.1 Basic Available #1.1 Basic Available Data Sources & Data Sources &

DownloadDownload

a) Planet OSMa) Planet OSM

b) Historyb) History

c) Diff. filesc) Diff. files

Page 11: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

c) Diff. filesc) Diff. files

“Contains changes in the OSM data over some period in time”

Minute/Hour/Day

Format=OsmChangeFile format used by osmosisosmosis and

osmconvertosmconvert

Contains: create/modify/delete

Page 12: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

c) Diff. filesc) Diff. files

Page 13: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#1.2 Other download #1.2 Other download optionsoptions

a) By Country / Region / a) By Country / Region / Area Area

b) By Small Region or by Typology

Page 14: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

a) By Country / Region / a) By Country / Region / AreaArea

Page 15: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#1.2 Other download #1.2 Other download optionsoptions

a) By Country / Region / a) By Country / Region / Area Area

b) By Small Region or by b) By Small Region or by TypologyTypology

Page 16: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

Tool: XAPI XAPI (Extended OSM API with search and query capabilities)

Example of data download by BBOXBBOX:http://open.mapquestapi.com/xapi/api/0.6/*[bbox=-77,38.8,-77.0,38.9]

Example of data download by BBOXBBOX and TAG/TYPE/ELEMENTTAG/TYPE/ELEMENT:

http://open.mapquestapi.com/xapi/api/0.6/node[amenity=university][bbox=-1.2,52.9,-1.0,52.9]

b) By small region...b) By small region...

Page 17: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

Tool: Overpass.API Overpass.API (Optimized, search criteria by location, type of objects, tag properties, proximity... or a combination)wget -O target.osm "http://overpass-api.de/api/interpreter?data=node[name=\"University of Nottingham\"];out;"

b) By small region...b) By small region...

node[“name”=”Bonn”];node

(around:1000)[“name”=”Gielgen”];

out body;

Page 18: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Data Edition#2 Data Edition

> How to participate?> How to participate?

Data capture: GPS & Digitizing

> What to do? Edit!> What to do? Edit!

Add new lines/points/areasModify existing lines/points/areasCorrect errors or mistakesAdd “characteristics” to elements

Page 19: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Data Edition#2 Data Edition

> TAGS> TAGS

Each element has a tag or several tags that give us its characteristics

Take a look at “OSM Map Features”

Wrong TAG → Wrong search → Wrong result

Page 20: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

Map Generation = Validation + Upload

Page 21: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Data Edition Tools#2 Data Edition Tools

More info: http://wiki.openstreetmap.org/wiki/Editing#Choice_of_editors

Page 22: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: #2 Top Data Editors: JOSMJOSM

Page 23: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: #2 Top Data Editors: JOSMJOSM

* Offline editor

* Simple and complex editions

* Import GPS Tracks, Manual digitizing, use of WMS, Topology validation and upload, ...

* Extra functionalities

* Documentation

Page 24: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: #2 Top Data Editors: MerkaartorMerkaartor

Page 25: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: #2 Top Data Editors: MerkaartorMerkaartor

* Offline editor

* Slightly different to JOSM

* Some specific tools: transparency

* Documentation

Page 26: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: #2 Top Data Editors: Potlatch 2Potlatch 2

Page 27: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: #2 Top Data Editors: Potlatch 2Potlatch 2

* On line editor

* Simple and fast editions

* Basic tools for edition and labeling

* Documentation

Page 28: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: iD#2 Top Data Editors: iD

Page 29: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#2 Top Data Editors: iD#2 Top Data Editors: iD

* On line editor

* Fast and friendly, intuitive GUI

* Simple and fast editions

* Tools for editing and labeling

* Supports displaying and editing route relations and turns restrictions

* Documentation

Page 30: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#3 Creating maps on the #3 Creating maps on the WebWeb

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" /> <!--[if lte IE 8]> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" /> <![endif]--> <script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script>

<div id="map" style=”height: 180px; width:400px”></div> <script type="text/javascript">

var map = L.map('map');var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';var osmAttrib='Map data © OpenStreetMap contributors';var osm = new L.TileLayer(osmUrl, {minZoom: 8, maxZoom: 12, attribution: osmAttrib});

map.setView(new L.LatLng(51.3, 0.7),9);map.addLayer(osm);

</script>

API Leaflet

Map: position & size

OSM LayerLayer

Properties

Initial coordinates

a) Tool: API Leaflet

Page 31: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#3 Creating maps on the #3 Creating maps on the WebWeb

API Leaflet

Map: position & size

OSM LayerLayer

Properties

Initial coordinates

Tool: API Leaflet

With just few lines of code

Javascript → Executed on client side

No requirements on server side

Page 32: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#4 Database import#4 Database importTool Use Schema Allow diff. files Contain predefined

geometriesContain all the attributes

osm2pgsql Rendering osm2pgsql Yes Yes No

osmosis Mirroring apidb Yes No Yes

osmosis Analysis pgsnapshot Yes Yes No

imposm Rendering imposm No Yes No

osm2pgsql Geocoding nominatim Yes Yes Yes

* Each tool generates a specific DB* Different use

* Organize the data: Schema → number of tables, columns and relations

Page 33: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#4 Database import#4 Database import

Tools > osm2pgsql: group elements into a table by feature type

Tables: planet_osm_polygon, planet_osm_line, planet_osm_point, planet_osm_roads

Configuration: default.style# OsmType Tag DataType Flagsnode,way highway text linearnode,way aerialway text linearnode,way aeroway text polygonnode,way amenity text polygon...

Page 34: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#4 Database import#4 Database import

Tools > Imposm: Generates one table for each type of entity: amenities, places, buildings, transport_points...

Tables with simplified spatial entities

Configuration: defaultmapping.py

towers = Points( name = 'towers', mapping = {'man_made': ('tower', 'water_tower') } fields = ( ('height', Integer()), ))

Page 35: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#5 Rendering#5 Rendering

Tools > # Mapnik (mapnik.org)

Allow the generation of raster layers based on geospatial data: PNG, JPEG, SVG and PDF

Tables with simplified spatial entitiesConfiguration: defaultmapping.py

Page 36: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

Tools > # Mapnik (mapnik.org)

Supports shapefiles, PostGIS, TIFF, rasters, osm as well as other formats supported by the gdal/ogr library

An XML (similar css) is used to the map design process

#5.1 Rendering#5.1 Rendering

Page 37: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#5.2 Rendering styles#5.2 Rendering styles

Tools > Tilemill, a software developed for cartographic design

Tilemill: Allows to define styles and render images (over Mapnik). Supports osm2pgsql and Imposm schemas

OsmBright, is a Tilemill project that offers a basis for representing OSM data

Page 38: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#5.2 Rendering styles#5.2 Rendering styles

Page 39: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#6 Routing#6 Routing

Tools > Osm2po (Multiplatform, requires Java 6+)

Osm2poOsm2po includes a GUI. Allows to generate SQL expressions compatible with pgRouting

Page 40: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

Page 41: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#6 Routing#6 Routing

Tools > Osm2pgrouting (requires PostgreSQL, PostGIS and pgRouting)

Osm2pgroutingOsm2pgrouting imports the data (osmaosma format) directly to a PostgreSQL / PostGIS database while generates the graph structure

Page 42: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#6 Routing#6 Routing

Tools > Osrm (C++)

OsrmOsrm implements a high performance routing engine for shortest paths in network analysis

It's very fast!

Page 43: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#7 Libraries#7 Libraries

Java, Perl, PHP, Python, R, Ruby

Imposm parser, osmread, J2memap, libosm, libOSM, libosmscout, libRoadNav, MapJumper, osm4routing, OSMLib, OsmSharp, ...

Page 44: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

BruTile, COSMCrtl, Halcyon, JXMapViewer, JMapViewer, JXMapKit, kogutowicz, libchamplain, Mapsforge, ...

#7 Widgets#7 Widgets

Page 45: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#8 Frameworks#8 Frameworks

* CloudMade* Osmium* Osmosis* OSMNavigation* libOSM

More info: http://wiki.openstreetmap.org/wiki/Frameworks

Page 46: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#9 Conclusions#9 Conclusions

With OSM we can do something more than download & edit data

The OSM evolution has promoted the appearance of a constellation of tools, that brings added value beyond the data

Page 47: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

#9 What's next?#9 What's next?

Keep this document open and alive and updated

Page 48: Things to do with OpenStreetMap

#foss4g13, Nottingham, Sept. 19th

A lot of thanks!A lot of thanks!

Lluís VicensLluís VicensSIGTE – Universitat de GironaSIGTE – Universitat de Girona