Post on 27-Jan-2015
description
transcript
#foss4g13, Nottingham, Sept. 19th
THINGS TO DO THINGS TO DO WITH WITH
OPENSTREETMAPOPENSTREETMAP
#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
#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
#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
#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
#foss4g13, Nottingham, Sept. 19th
a) Planet OSMa) Planet OSM
#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
#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
#foss4g13, Nottingham, Sept. 19th
b) Historyb) History
#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
#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
#foss4g13, Nottingham, Sept. 19th
c) Diff. filesc) Diff. files
#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
#foss4g13, Nottingham, Sept. 19th
a) By Country / Region / a) By Country / Region / AreaArea
#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
#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...
#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;
#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
#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
#foss4g13, Nottingham, Sept. 19th
Map Generation = Validation + Upload
#foss4g13, Nottingham, Sept. 19th
#2 Data Edition Tools#2 Data Edition Tools
More info: http://wiki.openstreetmap.org/wiki/Editing#Choice_of_editors
#foss4g13, Nottingham, Sept. 19th
#2 Top Data Editors: #2 Top Data Editors: JOSMJOSM
#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
#foss4g13, Nottingham, Sept. 19th
#2 Top Data Editors: #2 Top Data Editors: MerkaartorMerkaartor
#foss4g13, Nottingham, Sept. 19th
#2 Top Data Editors: #2 Top Data Editors: MerkaartorMerkaartor
* Offline editor
* Slightly different to JOSM
* Some specific tools: transparency
* Documentation
#foss4g13, Nottingham, Sept. 19th
#2 Top Data Editors: #2 Top Data Editors: Potlatch 2Potlatch 2
#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
#foss4g13, Nottingham, Sept. 19th
#2 Top Data Editors: iD#2 Top Data Editors: iD
#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
#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
#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
#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
#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...
#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()), ))
#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
#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
#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
#foss4g13, Nottingham, Sept. 19th
#5.2 Rendering styles#5.2 Rendering styles
#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
#foss4g13, Nottingham, Sept. 19th
#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
#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!
#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, ...
#foss4g13, Nottingham, Sept. 19th
BruTile, COSMCrtl, Halcyon, JXMapViewer, JMapViewer, JXMapKit, kogutowicz, libchamplain, Mapsforge, ...
#7 Widgets#7 Widgets
#foss4g13, Nottingham, Sept. 19th
#8 Frameworks#8 Frameworks
* CloudMade* Osmium* Osmosis* OSMNavigation* libOSM
More info: http://wiki.openstreetmap.org/wiki/Frameworks
#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
#foss4g13, Nottingham, Sept. 19th
#9 What's next?#9 What's next?
Keep this document open and alive and updated
#foss4g13, Nottingham, Sept. 19th
A lot of thanks!A lot of thanks!
Lluís VicensLluís VicensSIGTE – Universitat de GironaSIGTE – Universitat de Girona