OpenStreetMap (Ramm, Topf and Chilton)

OpenStreetMap: Using and Enhancing the Free Map of the World
by Frederik Ramm, Jochen Topf and Steve Chilton
UIT Cambridge, 2010. Paperback, 352 pp.
ISBN 978-1-906860-11-0

Book cover: OpenStreetMap Last year saw the publication in English of two books about OpenStreetMap. This one, Frederik Ramm and Jochen Topf’s OpenStreetMap, saw three German editions before being translated into this English edition, which Steve Chilton assisted with.

This is a comprehensive manual on using OpenStreetMap and its data, covering everything from contributing user data to editing, to using and hacking OSM data on websites and in applications. In other words, it covers everything — though not necessarily in thorough detail, with lots of references to OSM wiki pages for more information.

Now I’ve always found the OSM wiki to be a bit overwhelming; I think that this book does a better job of getting people up to speed on using OSM than trying to navigate the wiki pages (which is how I got up to speed, and wished for something clearer). Those who spend a lot of time on OSM will do well to have this on their shelf.

I think OSM needs more contributors, at least in Canada, where edits I left unfinished months ago are unchanged when I get back to them. So I read this book with an eye as to whether it would help beginners contribute. The first two parts of the book do a very good job of introducing the mapping process — collecting tracks, editing map data — to beginners, or at least that’s my impression. I even learned a couple of new things, and I’m a little less trepidatious about using JOSM (all my edits to date have been with Potlatch).
 


 
But people who are only interested in uploading GPS tracks and editing the map, rather than using OSM data in mashups and applications, won’t need to read past page 160.

Things move fast in the tech world, and the book has already been overtaken in one regard: most of the examples use Potlatch 1, which has been replaced by Potlatch 2 as the default web editor; I had to work to remember how to use the old editor. Serves me right for taking so long to get to this review.

The Open Street Map LinkedGeoData

Open Street Map Linked GeoData (RDF)

Making geographical data more discoverable and accessible:
Open Street Map Linked GeoData

LinkedGeoData is an effort to add a spatial dimension to the Web of Data / Semantic Web. LinkedGeoData uses the information collected by the OpenStreetMap project and makes it available as an RDF knowledge base according to the Linked Data principles. It interlinks this data with other knowledge bases in the Linking Open Data initiative.

The Linked Geo Data Knowledge Base

“In order to employ the Web as a medium for data and information integration, comprehensive datasets and vocabularies are required as they enable the disambiguation and alignment of other data and information. Many real-life information integration and aggregation tasks are impossible without comprehensive background knowledge related to spatial features of the ways, structures and landscapes surrounding us.

LinkedGeoData uses the comprehensive OpenStreetMap spatial data collection to create a large spatial knowledge base. It currently consists of information about approx. 350 million nodes and 30 million ways and the resulting RDF data comprises approximately 2 billion triples. The data is available according to the Linked Data principles and interlinked with DBpedia.

Accessing the data:

The following interfaces exist for online access:

  • Rest Api: provides basic access to a database with a full Open Street Map (OSM) planet file loaded.
  • Sparql Endpoints: enable queries on databases with a reduced (but hopefully for many applications relevant) subset of the whole data loaded. The Sparql Endpoints come in two flavours:
    • Static: Contains the data extracted from a OSM planet file of a certain date
    • Live: Initially a copy of the static version that is then synchronized with the minutely updates from OSM.


Example Link
http://browser.linkedgeodata.org/?lat=51.063657689874&lon=13.750735172091&zoom=16&prop=amenity&val=

Access to the Data
http://linkedgeodata.org/OnlineAccess

Open Street Map and ESRI tiles on Bing Maps

In a previous post, I explained how to replace the base tile layer in the Bing Maps Silverlight control with an ESRI tile layer. In this post, I’ll show how to do the same but using the Bing Maps AJAX v7 control. You can use this technique to use the Bing Maps AJAX control, but replace the Bing imagery with OSM tiles or the ESRI tile layers used in the previous Silverlight post, as well as many other tile sources.

The first step is to specify not to load the default Bing Maps tile layer. Do this by specifying the mercator MapTypeId in the options passed to the constructor when you first initialise the map:

[php]mapTypeId: Microsoft.Maps.MapTypeId.mercator[/php]

The next step is to create a new TileSource. The uriConstructor of the TileSource must return the correct URI for a requested tile. If your tile provider names its tiles according to the default Bing Maps quadkey numbering system, then the uriConstructor can be a simple string using the {quadkey} placeholder. This will be replaced with the appropriate quadkey when the tile is requested:

[php]var tileSource = new Microsoft.Maps.TileSource(
{  uriConstructor: ‘http://www.microsoft.com/maps/isdk/ajax/layers/lidar/{quadkey}.png’ }
);[/php]

However, for OSM tiles, or any other tile providers that not follow the basic quadkey numbering system, we instead need a function to construct the appropriate URI for each tile. I’ll do this in a function called getTilePath, and I’ll specify this in the TileSource uriConstructor as follows:

[php]var tileSource = new Microsoft.Maps.TileSource({ uriConstructor: getTilePath });[/php]

The getTilePath function will return a string with the appropriate URI for the requested tile. For OSM tiles, a typical tile looks like http://tile.openstreetmap.org/zoom/x/y.png. The function to create this tile is therefore:

[php]function getTilePath(tile) {
return "http://tile.openstreetmap.org/" + tile.levelOfDetail + "/" + tile.x + "/" + tile.y + ".png";
}[/php]

Put this all together and your code should look like this:

[php]<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
function GetMap() {
// Create a basic map
var map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
{ credentials: "YOURBINGMAPSKEYHERE",
center: new Microsoft.Maps.Location(56, 2),
zoom: 5,
// Don’t load the Bing base map tiles
mapTypeId: Microsoft.Maps.MapTypeId.mercator
});

// Create the tile source
var tileSource = new Microsoft.Maps.TileSource({ uriConstructor: getTilePath });

// Construct the layer using the tile source
var tilelayer = new Microsoft.Maps.TileLayer({ mercator: tileSource, opacity: 1 });

// Push the tile layer to the map
map.entities.push(tilelayer);
}

function getTilePath(tile) {
// Construct the URI path for an OSM tile based on tile zoom/x/y
return "http://tile.openstreetmap.org/" + tile.levelOfDetail + "/" + tile.x + "/" + tile.y + ".png";
}
</script>
</head>
<body onload="GetMap();">
<div id=’mapDiv’ style="position:relative; width:640px; height:480px;"></div>
</body>
</html>[/php]


And here’s what it looks like:

image

If you want to try some other tile providers, replace the URI constructed by the getTilePath() function with some of the following:

DeLorme World Basemap

[php]function getTilePath(tile) {
return "http://server.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer/tile/"
+ tile.levelOfDetail + "/" + tile.y + "/" + tile.x;
}[/php]

image

ESRI World Imagery

[php]function getTilePath(tile) {
return "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/"
+ tile.levelOfDetail + "/" + tile.y + "/" + tile.x;
}[/php]

image