Things To Do With OpenStreetMap

Lluis Vicens Franquesa (SIGTE-Universitat de Girona) with Gemma Boix Xamani (SIGTE-Universitat de Girona), Toni Hernandez Vallés (SIGTE-Universitat de Girona)

14:00 on Thursday 19th September (in Session 15, starting at 2 p.m., EMCC: Room 4)

Show in Timetable

Description: OpenStreetMap is much more than a set of data. In this presentation we show a good portion of the possibilities it offers. We will see, first of all, what data one can download from OpenStreetMap and how it can be downloaded in a personalized way, employing customizable criteria. In addition to downloading, we look at other tools that add value to OSM: editors, importers to databases, geolocation services, image rendering, routing algorithms, etc.
Abstract:

INTRODUCTION 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 article we will examine the possibilities offered by OpenStreetMap and the main tools allowing one to operate with this data. AVAILABLE DATA AND DOWNLOADING There are three types of files ready to be downloaded. - planet.osm. This file, which takes up about 26 Gb in compressed format (pbf), contains all the OpenStreetMap mapping for the entire planet and is generated weekly. - history.osm. This file (39 Gb in compressed format) file is generated less frequently than the planet file and contains the entire history of the OSM database. - diff files. Due to the large volume of data handled in OpenStreetMap there are a number of differential (diff) files containing the database modifications carried out during a specific period (inserts, modifications, deletions). If one wishes to carry out more customized downloads (by country, region, city, etc.) he can download pregenerated extracts from the original database. These extracts can be downloaded from third-party sites that OSM makes available at its wiki (http://wiki.openstreetmap.org/wiki/Planet.osm). But if one wishes to customize his downloads even further (with more specific areas, or according to types of entities, such as main roads, parks, etc.), OSM also offers the possibility of using its APIs (Xpai, Overpass API) which, thanks to their REST interface, make it possible to download such data through the generation of URLs. DATA GENERATION AND EDITING The main way to participate in OSM is by editing the map, whether capturing the geographical data through GPS and mobile devices or using other open data sources. The workflow to generate OpenStreetMap data is as follows: 1. Data capture and acquisition 2. Data generation and editing 3. Data labelling 4. Map generation On the OSM wiki there is a complete list of editors (http://wiki.openstreetmap.org/wiki/Editing): PUBLICATION OF PERSONALIZED MAPS ON THE INTERNET The publication of maps on the Internet is one of the most common tasks carried out using OSM data. Thanks to free tools such as Leaflet and OpenLayers (to name two of the most widespread) one can, in just a few lines of code, generate maps for his webpages, blogs, etc. These tools are developed in Javascript code run on the client side, so these maps do not have any requirements on the server side and can be applied to any webpage. In the specific case of the Leaflet API, generating a map which shows the OSM mapping with the initial view one indicates (initial map coordinates and zoom level) is as simple as changing a couple of lines of code. IMPORTING OSM DATA TO DATABASES There are several tools to import data to databases in .osm format. The main ones are osm2pgsql, osmosis, imposm and nominatim. These tools are designed to organize data (within the databases) in accordance with schemes designed for some very specific uses. For example, osm2pgsql and imposm tools are designed to generate some highly efficient databases with a view to rendering. Other tools, such as nominatim, generate a scheme designed for geocoding, etc. Each tool, therefore, generates a scheme. The main features of these schemes are three: • They are updatable. • They contain predefined geometries. • They contain all the attributes (comprehensive). RENDERING AND STYLES Rendering is the conversion of data into an image. During the rendering process the data to be included in the image is defined (on the basis of its attributes) and its style (colour, thickness, colour of the edge, symbols, the scale of the map at which an element is to appear, the scale of map at which it is to disappear, etc.). The complexity of rendering OSM data is mainly determined by three factors: the intricacy of each style, the great variety of different elements containing OSM and, thirdly, the fact that each level of zoom (up to 22) may have assigned a few unique styles for each element of the map. It is easy, thus, to imagine the effort required during the rendering. The tool used for this process is mapnik (available both for Windows and Linux systems). Mapnik, in addition to featuring a set of very versatile styles, gives one the possibility of partitioning the images generated into tiles to streamline their transmission on the Internet. In this way the transferred images are smaller and the map navigation gains enhanced fluidity. Mapnik recognizes many different input formats (PostGIS, shp, tiff; OGR, GDAL and raster formats, etc.) and makes it possible to generate output images in the formats png, jpg, pdf, svg, tiff, etc. Although the generation of styles is a very laborious process, there are tools like TileMill which speed up those processes through a user-friendly graphic interface. Tilemill includes mapnik in its installation as a rendering engine. Within TileMill one can upload the OSMBright project, which contains a set of pre-defined styles for OpenStreetMap. In this way one can customize his data, starting out from a previous definition and focusing only on those items which he wishes to highlight or customize. ROUTING One of the tools intermediate users will find easiest to use is osm2po, one developed in Java (multiplatform) which makes possible, via a few simple commands, the importation of .osm data and the creation of a Web service to process optimal route calculations in a web environment. Another tool, for slightly more advanced user profiles, is osm2pgrouting. Available on Linux systems, Osm2pgrouting allows one to import .osm data to a PostgreSQL/PostGIS database. It also generates the graph structure (as one more table) necessary for the calculation of optimal routes. With the graph one can modify the costs associated with the connections between nodes and, in this way, customize the routes according to his needs in each case. Osm2pgrouting requires, in addition to a PostGIS type database, pgRouting functions. pgRouting extends a PostgreSQL/PostGIS spatial database to include route calculation functionality.