# tianjara.net | Andrew Harvey's Blog

### Entries tagged "osm".

9th October 2012

I've recently pushed out a new srtm3-stylesheets repository which contains shell scripts for working with NASA SRTM DEM data, gdaldem based stylesheets for shaded relief maps, Mapnik stylesheets for contours and a TileStache configuration for sandwich those styles together into a single map.

This was spurred on by the fact that I simply needed a map which showed hills. I've used Andy Allan's OpenCycleMap in the past which has color relief and contours. Unfortunately it is closed source.

So I put my head down and hacked together repeatable scripts to get the source data up and running and some basic stylesheets to produce a usable and pleasant looking map. All released as free and open source software under the CC0 license.

I want to avoid adding things like streets etc, such maps could be built as separated layers based upon this style and sandwiched together, for example, with the TileStache sandwich provider.

I hope to build upon the lessons learnt here to produce a map like the Stamen Terrain map, except with the source code released under a free and open source license. Perhaps just with hill and slope shading applied to landuse with other map features placed on top.

I've rendered NSW (only server resource prevent worldwide!) as a slippy map here.

Tags: dev, geo, osm.
11th December 2011

## Map Labelling Suburbs and Cities

Yesterday I pushed a bunch of changes to my OSM/Aerial Imagery Hybrid Style, see the (demo). I spent a bit of time on suburb and city labels as they are a really important feature of a map aimed at non-experts.

I'm finding making a non-trivial style like this has defiantly made me realise the difficulties of such a task.

There are a lot of improvements that can be made (either by modifying or making new components) to the OSM Mapping conventions, osm2pgsql/imposm, mapnik library, carto language stack. That said, the current form is still great and you can still make great maps. But,

I would like to be able to but this needs
have labels for large bays at lower zooms than small bays need bays mapped as closed ways covering their area, rather than a point in the centre
define a linear function for the size of icons. i.e. at z10 the icon is 10px, at z20 the icon is 20px, now linearly interpolate all sizes for zooms in between either build this functionality into the carto language, or make another higher level macro like language which you can code this in which is then compiled into carto
render spread text inside a riverbank needs functionality in the mapnik rendering engine

## Static OSM Tiles

I'm still yet to find a tile server which is fast and works well with lighttpd (nginx would probably suffice too). As an experiment I decided to pre-render a bunch of tiles for my hybrid style sheet. This tile layer doesn't need to be minutely updated, anyone who needs that can use the normal mapnik layer. Also static tiles server straight from the webserver should be pretty fast (maybe on memcached tiles would be faster) and I wanted my tiles to be fast.

Next up how can I generate these static tiles? There is the popular generate_tiles.py, but that won't render meta tiles, seems like such a waste to render every tile with a buffer of 128px when I would render a 5 by 5 meta tile of the same buffer for only 36% of the total pixels rendered. The larger the meta tiles the larger the latency, but if I'm pre-rendering them all than latency doesn't matter any more.

So I wrote a C++ program as my replacement for generate_tiles.py. I also programmed it to render from a list of meta tiles rather than a bbox. This means for my demo I can only render high zooms where there is nearmap coverage. This is where https://github.com/andrewharvey/OSMTileListFromGeometry/ came in, which pulls nearmap coverage areas from an osm2pgsql database, and generates a list of meta tiles.

Using this method I rendered up to and including zoom 17, composed of 22444 5 by 5 meta tiles or 561100 regular tiles in a time of,

real    198m17.021s
user    103m49.985s
sys     37m36.117s

with disk usage,

<1M   0-8
2.0M  9
6.8M  10
26M   11
98M   12
13M   13
36M   14
114M  15
411M  16
1.5G  17
========
2.2G  total


(Updated with results when using "png" rather than "png256")

real    228m17.082s
user    160m24.725s
sys     31m42.653s

with disk usage,

<1M   0-8
3.1M  9
8.6M  10
28M   11
121M  12
34M   13
83M   14
218M  15
663M  16
2.0G  17
========
3.1G total


I think that time could still be sped up with,

• tuning of the mapnik stylesheet queries
• tuning of the postgres database
• using larger meta tiles
• using a machine with more that 512MB of RAM
• not running minutely updates in the background

## Git Rebase

As I use git more and more I'm slowing learning more of the features it has to offer (and thanks to the free hosting by github). One such feature which I think is awesome is git rebase. As an example the other day I did git commit -ammend instead of git commit --amend (I knew there was a duplicate character somewhere but because I seem to have a tint of dyslexia I confused the duplicate -- with mm).

Of course this resulted in committing all files which had changed with a message of "mend" as a new commit. I did this twice, and only noticed after I had already made a bunch of correct commits afterwards. With git rebase I could pop some commits of the commit stack, remove the two "mend" commits fix the commit which I should have been amended to and pop my other commits back on top of the stack.

Thanks to http://stackoverflow.com/a/180085.

## Next Up

• build a daily OSM planet extract by pushing minute-replicate files into the osmosis psql simple schema, then dumping to an OSM file
• use this OSM file as a basis for monav and an OSRM service for fosm data
• run a name finder service for fosm data
• more updates to the hybrid map style
• render the hybrid style tiles as oblique images for nearmap multiview
Tags: dev, geo, osm.
9th October 2011

I feel the map style I've been working on recently is in good enough shape to announce. It is written in carto and designed to be used with OpenStreetMap data. It is an overlay layer for aerial imagery, though in my example I use NearMap imagery.

Take a look at http://tianjara.net/osmt.html.

The source is at https://github.com/andrewharvey/osm-hybrid-carto/, licensed CC-BY-SA.

There is still lots of work to do on it though.

I also have a lightweight cycle-overlay too (view example at http://tianjara.net/leaflet.html and tick on the cycle overlay or view the code at https://gist.github.com/1216315)

Tags: geo, osm.
12th September 2011

Just a quick update to say that I have exhausted all my options to build a latest .osm file from fosm.org minute-replicate osc files + a base .osm file from osm.org. Currently fosm.org is down, but I still want to edit on top of the latest data so I can submit my changesets when it comes back online. This is proving to be more difficult that I thought. Although really it is a good thing as even though I've tried to ensure I have everything I need to rebuild fosm.org if it were to go down for good, I'm still not 100% sure as I haven't tried, well now I get to try.

My first method was to use osmconvert with the aid of the workflow given in https://github.com/rrankin/osmconvert/blob/e1fbb7319f92f338e0023d110a3098f5a979fd64/update_osm.sh. It was quite fast and it almost worked, but due to limitation of osmconvert it seems that it expects the objects to be sorted in the order given by the object IDs. We can either patch osmconvert to work around this, or sort the osc files...

Putting the first method on hold, I gave installing the rails port that runs the API at osm.org a go with the idea that I can load the changesets or osc files directly into the API or DB. I got it installed and got to the step of loading in my starting OSM .osm file from before the FOSM fork. http://wiki.openstreetmap.org/wiki/The_Rails_Port#Populating_the_database even gives the command line to run, but osmosis didn't like this. I believe the issue is fixed with later versions of osmosis though.

This leads me to require a later version of osmosis. I don't really want to install osmosis from source using the upstream project's method as it will pull in a bunch of 3rd party libraries using maven, so the only real option is to work to upgrade the debian package for osmosis. This isn't easy either as I don't know that much about ant/maven/ivy. I could spend I whole weekend just trying to update the debian package of osmosis and still get nowhere, all the time I'm just getting further away from my original goal which was to make some FOSM changesets from my latest trip while my memory is still fresh...

Tags: debian, dev, osm.
6th June 2011

A short time ago TileMill got support for PostGIS data sources. I'm really excited by this as it means you can use TileMill, which is very easy to use, having a gentle learning curve, to construct your own OpenStreetMap stylesheets and see the data being rendered using your style. This is great! e.g. in less than an hour I made this,

[caption id="attachment_1306" align="aligncenter" width="600" caption="Map data © OpenStreetMap contributors, CC-BY-SA"][/caption]

Want a map which just shows the drainage network (which you can see from low zooms)? Easy.

[caption id="attachment_1307" align="aligncenter" width="600" caption="Map data © OpenStreetMap contributors, CC-BY-SA"][/caption]

I'm sure I'll be publishing lots of new styles in the near future, one of which will be a style designed as an aerial image (NearMap) overlay. Exciting times ahead...

Tags: geo, osm.
17th March 2011

A little while ago Marcus Blake from the Australian Bureau of Statistics asked the OSM community about the potential use of some ABS data. As I mentioned on the list I think it is good that at least some government departments are making their data available under free licenses and that they engage with with the community to sort out any technical details about the data.

As described by the ABS, the ASGS is essentially data describing geographical areas.

[caption id="attachment_1290" align="aligncenter" width="580" caption="ASGS ABS Structures - CC-BY 2.5 AU Australian Bureau of Statistics"][/caption]

[caption id="attachment_1291" align="aligncenter" width="600" caption="ASGS Non-ABS Structures - CC-BY 2.5 AU Australian Bureau of Statistics"][/caption]

Working out which if any structures should be incorporated into OSM and how needs careful consideration, and I've posted some of my thoughts to the list. In the mean time, since the data does contain some landuse information I've been looking into how best to use this information to aid in mapping. A blind import is not an option in my opinion, but I thought it would be handy to see the data as a base map when mapping.

I did try using ogr2osm to convert the data to the OSM xml format to load into JOSM (I even got the translateAttributes function for ogr2osm working for this dataset), but due to the nature of the data, I think a simple raster underlay works well. I tried two approaches in parallel.

1. shp -> osm (using ogr2osm) -> postgres (using osm2pgsql) -> raster tiles (using mapnik).
2. Using GeoServer to serve a WMS which can be loaded into JOSM.

Option 2 seemed to require less set up time. Simply used the GUI to load the shapefile, and apply a style. Then load the WMS into JOSM.

[caption id="attachment_1295" align="aligncenter" width="600" caption="ABS Mech Blocks with landuse styling in JOSM, with NearMap underlay."][/caption]

One caveat, if you want to load a WMS services from GeoServer into JOSM, I found the URL should look something like:

http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=workspace_name:layer_name&styles=&format=image/png&

Slightly unrelated but if you are using tomcat or jetty locally but only occasionally (like I do), I find it is best to use sysv-rc-conf (eg. sudo sysv-rc-conf tomcat6 off) to disable the tomcat or jetty daemon from running at boot, whilst still allowing you to start it (sudo service tomcat6 start) when you need it.

If anyone is interested in getting such data in JOSM and would like more details, just let me know.

Tags: geo, gov, osm.
14th February 2011

For a while I used to think that all there was to XML was <blah attribute="value">inner</blah>, but of course there is much more. I'm now digging into the real stuff like XPath, XSLT and XML Schemas.

I've come across a data set of bus stops (as well as live info on where buses are, and their status). The bus stop data set (http://nswbusdata.info/ptipslivedata/getptipslivedata?filename=stopdescriptions.zip, no longer active so I'm hosting my original copies at http://tianjara.net/data/nsw-buses/ for preservation) is in an XML format,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<stop longitude="151.17832" latitude="-33.81852" tsndescription="Osborne Rd nr Ronald Av" TSN="206699"/>
<stop longitude="151.17359" latitude="-33.8082" tsndescription="Ralston St nr Murray St" TSN="2066138"/>
<stop longitude="151.17764" latitude="-33.82054" tsndescription="Second Av nr Osborne Rd" TSN="206698"/>
<stop longitude="151.17629" latitude="-33.81926" tsndescription="Fourth Av nr Second Av" TSN="206697"/>
...

Although because of the license, I cannot use this data in OpenStreetMap, I was still interested in converting it into an a .osm file. The perfect job for XSLT!

It turned out to be quite a simple task with a neat solution. My XSLT stylesheet used to do the translation:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/StopDescriptionList">
<osm version='0.6' generator='XSLT'>
<xsl:apply-templates select="stop"/>
</osm>
</xsl:template>

<xsl:template match="stop">
<xsl:variable name="count">
<xsl:number/>
</xsl:variable>

<node id='-{$count}' lat="{@latitude}" lon="{@longitude}"> <tag k='ref:tsn' v='{@TSN}' /> <tag k='fixme' v='{@tsndescription}' /> </node> </xsl:template> </xsl:stylesheet> Then it was a just a simple, xsltproc -o busses.osm busses-stylesheet.xslt stopdescription.xml The data is CC BY-NC-ND 3.0, but they sneak in some additional terms in the fine print, which in addition to the NC-ND would further lead to incompatibilities with the OSM license, and would under my definition of free data, make this data set non-free. For interest the first three additional terms are, 1. You must not use the Data in any way that could create false or misleading outcomes or interpretations, or bring the RTA into ridicule or disrepute. You must not use the Data in conjunction with the promotion of alcohol or unsafe road practices. 2. You must ensure that the Data used is current, and provide details as to the date and time of sourcing the Data from the RTA in all reproductions of the Data (including in any software applications incorporating the Data). 3. In all reproductions of the Data (including in any software applications incorporating the Data), the following disclaimer must be provided: “The accuracy or suitability of the Data is not verified and it is provided on an “as is” basis.” Tags: dev, osm. 16th January 2011 In the past few months I've been contributing to the OpenStreetMap database. From the day I started I've had privacy concerns on my mind. If a criminal goes around committing crimes, leaving behind a signature and always travelling x km from home to commit the crime, you get a nice circle around their home. So I'm interested to see what kind of pattern I'm leaving behind. Someone else has probably got an existing solution out there, but I decided to experiment and put together something myself. I already had all my osmChange files (i.e. the ones from http://www.openstreetmap.org/api/0.6/changeset/${changeset_id}/download). I pull these daily from http://api.openstreetmap.org/api/0.6/changesets?display_name=aharvey find the changeset ids and download the osmChange files for all my new changesets. I do this as I try to keep a local copy of things I upload into the cloud, as a backup in case the service I uploaded to ever decides to cut my access. I know I should really be saving a copy of what I upload, rather than uploading then asking the cloud server for a copy, but JOSM uploads a full osm file, not an osmChange file. Scripts here.

Anyway, from these osmChange files I pull out the coordinates of all the nodes I created or modified, script here.

From this list of points I could use any heat map program. gheat which is based on http://blog.corunet.com/the-definitive-heatmap/ looks good. The problem is I ran out of time setting it up– it wasn't in the Debian repository. Instead I used http://www.sethoscope.net/heatmap/, which I combined with a wrapper script to render to tiles in the OSM Slippy Map format. However it is really slow– perhaps I should try to speed it up.

Now that I had the transparent heat map tiles, the next step was to get these on top of an OpenStreetMap map. Given they are in the standard format, it should be really easy to add this layer to any software that lets you view OSM tiles. Support for overlays like this in libchamplain is on my todo list, in the meantime I gave Polymaps a try, HTML with JavaScript embedded here.

[caption id="attachment_1246" align="aligncenter" width="600" caption="Heat map image of my created or modified nodes in OpenStreetMap"][/caption]

The results don't come as much of a surprise, I already knew which areas I edit and how much. This map is also biased towards nodes, and doesn't take into account editing an existing way or relation. One surprise was some cosmetic work along creeks shows up as nice lines (tracing a creek adds a lot more nodes than adding a single toilet node)...

## Postscript

While I was working on this I once again needed a bbox string to test with. This has come up a lot in the past and I didn't know any easily way to use a GUI to position the map, and then just copy and paste the bounding box of that view. So I made a modification to one of the libchamplain demos to return a bounding box from the current view.

Tags: geo, osm.
28th November 2010

I should have made a post about this a while ago, but I didn't want a half complete post, and the scope of my project kept expanding!

## Part 1: Scraping

I found two huge repositories of old digitised maps of Australia, many of which are in the public domain. The National Library of Australia and Parish Maps from the Department of Lands NSW. Unfortunately they didn't really have a nice documented RESTfull API for the use of the images and metadata. My first step was to extract as much information as I could and convert it into an intermediate format. Most of my code and documentation for doing this is at https://github.com/andrewharvey/govscrape in those two respective folders. Unfortunately it's not as easy as running one command from my repo to download and parse all the data. My goal was to get the data to my machine, not write a robust system that anyone could run to get a clone of the nla and pmap repositories.

## Part 2: Georeferencing

It would be great if I could push out an easy to use API for the data I collected from the scrape stage, but I don't have the resources (let me know if you are willing to help out with server resources to host these old public domain maps). Even without a nice interface to the data, I could still play around with it and to see what use I could make of it. I dabbled into using these maps as a source of data for OpenStreetMap. I only got through a few of the maps, I put this on hold as I figured it would be easier (especially for others) to do this if they were georeferenced. I tried out both http://warper.geothings.net/ and QuantumGIS, but both had way to much lagging. So I rolled out my own solution which was just a bunch of scripts which used Inkscape and a hacked libchamplain demo as the GUI. The code and documentation for this is at https://github.com/andrewharvey/georeferencing-scripts.

The georeferencing data that I have made so far (it's a big task!) is at https://github.com/andrewharvey/georeferencing-data.

## Part 3: Sharing

From the data and code from the last step, I'm able to push out these old maps in several formats. I used gdalwarp to convert the maps into Transverse Mercator (well actually I don't really know what they are, but this seems to work), from here I can use gdal2tiles.py (...finally understanding the difference between OSM Slippy map tilesnames and the OGC TMS... take note that gdal2tiles.py produces TMS format tiles which differs from OSM style as it has the y axis going bottom to top, see http://groups.google.com/group/maptiler/browse_thread/thread/aa89fc726b8f7261/8bdc39d7829cc80c) to push out an OSM slippy map like tile directory, I can push out a KML GroundOverlay, or you could probably use a WMS server to push it out through WMS. I really wanted to leave it open.

[caption id="attachment_1235" align="aligncenter" width="600" caption="Overlay from public domain map, http://nla.gov.au/nla.map-rm2795. Background CC BY-SA 2.0 OpenStreetMap Contributors, http://www.openstreetmap.org/"][/caption]

[caption id="attachment_1236" align="aligncenter" width="600" caption="Parishmap as backgrop in JOSM. Data CC BY-SA 2.0 OpenStreetMap Contributors, http://www.openstreetmap.org/. Background public domain map PMapMN04/14015601."][/caption]

[caption id="attachment_1237" align="aligncenter" width="600" caption="Overlay from public domain map, PMapMN04/14015601. Background CC BY-SA 2.0 OpenStreetMap Contributors, http://www.openstreetmap.org/"][/caption]

I would post a Google Earth one too, but its too much effort to get a free background in there for the screenshot. I'm not convinced that this display of the data is user friendly. Having control of the transparency of the overlay is a must. Maybe one day, someone will crop out all the non-map parts of the parish maps so we can get a single whole of NSW parish map slippy map.

I suppose now I need to focus on the infrastructure. It should be really easy for a user to browse the available maps and view them either as a KML, an OpenLayers overlay. I should also plug this into the meta-data I scraped and have stored in CSV like files.

The problem I have with distribution right now is that many of the maps need warping and that means I need to host the warped image somewhere. Some could probably be georeferenced from their source image using just translate, scale and rotate, and hence should be able to use the source image from the government server to serve the georeferenced imagery. But the work flow I've set up so far, relies on using gdalwarp, and hence having access to the warped image.

Tags: geo, gov, osm.
28th November 2010

I made this image to help my understand a slippy map tile naming system for maps that don't always point North (it turns out nothing changes in terms of the tile numbering, you just have to apply additional view space transformations). This is how Nearmap does it, and when I get around to putting up http://osm.kyblsoft.cz/3dmapa/ like tiles of Sydney I will endeavor to use the same system (in other words you put your code to view the other views in your map viewer application, rather than just change the tile numbering so that you can use existing code for all the views). It doesn't really change anything here if we have square or non-square tiles, the tile numbers and true coordinates don't change because of this. Keep in mind that all the points of tile z/y/x for any of these views will be the geographic location, the views just have a different view space translation.

[caption id="attachment_1227" align="aligncenter" width="600" caption="Diagram CC BY-SA. Map tiles CC BY-SA based on CC BY-SA data from www.openstreetmap.org."][/caption]

Tags: nearmap, osm.
12th November 2010

I've taken some time to look at the NearMap licenses (Community License, Free Commercial License) more closely. Here is some of my commentary of them. I'll use the terminology used in the licences so please excuse me for using their language and jargon. When I say free I mean free as in "free software", "free culture" and "free as in freedom". Also this is just my interpretation from reading them, I am not a lawyer. Hopefully I've interpreted them as NearMap intended.

## Derived Works

"ShareAlike is an imperfect solution to copyright restrictions, as it imposes one restriction of its own: a restriction against imposing any further restrictions. It's an attempt to use copyright against itself. As long as we live in a world wherein everything is copyrighted by default, I will use ShareAlike or some other Copyleft equivalent to attempt to maintain a "copyright-free zone" around my works. In a better world, there would be no automatic copyright and thus no need for me to use any license at all. Should that Utopia come about, I will remove all licenses from all my work. Meanwhile I attempt to limit other peoples' freedom to limit other peoples' freedom." -- http://questioncopyright.org/CC-branding-confusion

Another important observation that I previously overlooked is the fact that,

"You will own all Derived Works that you create. However, you may only distribute Derived Works to others on the terms of a Creative Commons Attribution Share Alike (CC-BY-SA) licence (and you may use any version of that licence you wish, whether localised for a particular country or not). For example, you may Use the Licensed PhotoMaps or Modified PhotoMaps to obtain information which you can then use, under the Creative Commons Attribution Share Alike (CC-BY-SA) licence, to populate or update community street mapping projects." -- http://www.nearmap.com/products/community-licence#clause5

Previously I had thought that any derived works that came from NearMap PhotoMaps used in OpenStreetMap needed to be attributed to NearMap. I guess I just incorrectly thought that all the information was CC BY-SA licensed by NearMap, but that is not the case. These works actually need to be attributed to the user who observed that information and turned it into a work by, for example, adding it into the OSM database. The works do not need to be attributed in any way to NearMap.1 This also means that any copyright that arises from any creativity in deciding what to trace, and any copyright that arises from the tracing being a derivative work can be treated as CC BY-SA licensed by that person or user. That person is the copyright holder but they are only allowed to distribute the work under a CC BY-SA license. This is a good thing! I'm glad that NearMap have not chosen to change the wording to make it compatible with the public-domain-like OpenStreetMap contributor terms, as (unless of course one has some other license from NearMap) it guarantees that this information remains free2.

The discussion and use of Yahoo imagery as a source of tracing for OpenStreetMap was before my time, but from http://wiki.openstreetmap.org/wiki/Yahoo it seems that strong legal foundations are lacking. In this respect I feel much safer tracing from NearMap. I know that my contributions can be licensed under the free CC BY-SA license and nothing can be done to unfree these works. Whereas the legalities of Yahoo imagery is, at least from my reading, very questionable and potentially a huge problem in the future.

## Modified Works

Another reason I took a closer look at the licenses was to make sure that the works I posted earlier which were modified PhotoMaps complied with all licensing requirements, both the NearMap and OpenStreetMap requirements. I have come to the conclusion that unfortunately I am most likely unable to satisfy both the Mapnik share-alike requirement and the NearMap share-alike requirement in coexistence.

The NearMap "free community licence" gives me the "right to use, copy, modify and distribute our PhotoMaps". The distribution to others clause says that I must give NearMap attribution for the distribution of any original or modified PhotoMaps, however the license also says "You may sublicense your rights to the Licensed PhotoMaps, Modified PhotoMaps or APIs to others on the same terms as this licence or our free commercial licence." I interpret this as if I modify a PhotoMap I need release it under the "NearMap free community license", that is it is share-alike.

On the other hand though, I also used the default OpenStreetMap Mapnik-style map images. My understanding is that like the data used to create these maps, the actual map images are copyrighted by all the OpenStreetMap contributors and released under the CC BY-SA license. The share-alike means that any derivative works (like overlaying NearMap terrain maps) must the released under a CC BY-SA compatible license, so you cannot impose non-commercial or non-government on it. However although the NearMap free community licence plus the NearMap free commercial license almost allow anyone to use or modify the work they don't meet CC BY-SA because they exclude government and exclude commercial use made in a "competing manner" and use that is "material to their business". This leaves me to believe that I cannot legally distribute any work that is a mash-up of OSM data/maps and NearMap PhotoMaps. Unless of course that it is only the default Mapnik tiles that are CC BY-SA, and that anyone can copyright map images made from OSM data. Because NearMap uses OSM data to create Mapnik tiles using their own map style. I assume then that it is only the OSM data that is CC BY-SA and someone is free to make a non-free map using their own style from this data. Then they would own the copyright to that map and hence you would be free to combine this with NearMap's PhotoMaps and release the product under their free community license. This could also explain why NearMap can overlay their transparent tiles based on OSM data over their non CC BY-SA imagery.

It is a shame, but I can totally understand NearMap restricting use of their PhotoMaps in a specific field of endeavor, namely the government. The government is central to their current revenue stream, without it they probably could not produce the volume of work they currently do under their almost free, community license. It is almost CC BY-SA, except they exclude three fields of endeavor, "Competing Manner", "Material to their business" and "Government Entities that use our PhotoMaps for their own governmental purposes". The first two exclusions make the PhotoMaps near CC BY-NC-SA, but the last clause means they cannot be compatible with any of the Creative Commons licenses.

Let me use the example case of distribution of original NearMap PhotoMaps. For instance say I download a bunch of imagery tiles and distribute them through BitTorrent, the key question here is do I need to enforce that this distribution is to non-government entities. If I am only allowed to distribute it to non-government, I cannot do that, so the freedoms that the license grants are not as broad as I thought. If on the other hand if I can distribute the works to government entities along with the free community license as a LICENSE file, but leave the responsibility and liability on the government to not use the works I make available, then this would be much better. Hopefully the latter is the case. This was almost touched on here, but which party the liability lies on was not mentioned.

## Termination

This is why I hate reading all this legal jargon, every word is important but has different interpretations. Code on the other hand has just one interpretation, and that is defined in the compiler... Anyway, at first I thought this termination clause meant NearMap could terminate the license grant at any time, however I missed the words "if the other party breaches this licence". I view this to mean that NearMap cannot terminate the license grant unless you breach the license. But even if such a case arose, derived information is safe. So NearMap can do nothing to prevent the CC BY-SA distribution of derived information. Although it appears all the other parts of the license grant can be subject to this clause.

1 However I still think that one should attribute NearMap regardless. In the OSM case, attribution using the source tag should be done for other reasons as well; like so people know where the data came from, hinting some clues of the quality of the data.

28th October 2010

Some eye candy from my experiments of combining Nearmap terrain tiles with OpenStreetMap tiles. These images (which are hyperlinked to full sized ones) are derived works from OpenStreetMap.org default mapnik tiles (which is based on data from OpenStreetMap contributors licensed CC BY-SA 2.0), and Nearmap.com shaded relief terrain maps licensed under the Nearmap Community License.

[caption id="attachment_1198" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."][/caption]

[caption id="attachment_1199" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."][/caption]

[caption id="attachment_1200" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."][/caption]

[caption id="attachment_1201" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."][/caption]

[caption id="attachment_1202" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."][/caption]

My approach is based on http://wiki.openstreetmap.org/wiki/TopOSM/Details. I used two mapnik stylesheets, one for everything minus the labels, and one with just the labels. From here I used this bash script,

[sourcecode language="bash"] for f in nearmap-dem///* do f=echo $f|sed 's/[^\/]*\///' #get rid of the nearmap-dem part d=dirname$f mkdir -p "grayshaded/$d" # convert "nearmap-dem/$f" -colorspace gray "grayshaded/$f" #just convert to gray # ...alternatively, extract the Lightness channel... convert "nearmap-dem/$f" -separate -channel Lightness -colorspace gray "grayshaded/$f" lastdir=dirname &quot;grayshaded/$f&quot; lastfile=basename &quot;grayshaded/$f&quot; .png rm -f "$lastdir/$lastfile-0.png" "$lastdir/$lastfile-2.png" mv "$lastdir/$lastfile-1.png" "$lastdir/\$lastfile.png" done [/sourcecode]

to convert a directory of Nearmap Terrain tiles into something suitable to be passed in as the hillshade layer to the combine script at http://wiki.openstreetmap.org/wiki/TopOSM/Details#Combining_images_into_a_final_composite, and then I used combine script to merge the layers together for each tile.

Update: The Mapnik stylesheets I used for labels and nolabels are at http://gist.github.com/653184

Tags: dev, nearmap, osm.
25th October 2010

So a while back Geoscience Australia stuck this notice on their website,

Great, another source of free government data. So today when I find a use for some data held on their site I was very dissapointed to see,

"Please note: Any organisation or individual wanting to use the Gazetteer data in a similar capacity to the Online Place Name Search or any other online application, will require an Internet user licence. (See the Licence Fees and Order Form below)."

So much for the CC-BY license. The latter notice is an "otherwise noted" which says, this data is NOT CC-BY because if you want to use it for such an such purpose you need to get another license to allow you to do that.

11th October 2010

...I was thinking, short of having a high resolution accurate computer model of the world (i.e. digital terrain model with an orthophoto on the terrain + accurate 3D models of buildings, bridges, trees, etc), one can use these "oblique" aerial views to similate other low angle views.

[caption id="attachment_1178" align="aligncenter" width="573" caption="Sydney North Oblique view. Image tiles from NearMap. Used under the http://www.nearmap.com/products/community-licence license."][/caption]

What I mean is that Google Earth uses orthophotos as the ground texture. For some places they also have rough building models and these make low angles (ie. when you are not looking straight down towards the earth's surface) in Google Earth look a little bit more real. An alternative, when we lack a high resolution accurate model, for an interactive Google Earth like application is to use overhead orthorectified imagery when the user is looking from above, and use the oblique views (called MultiView on NearMap) when the angle between the direction of view and the ellipsoid surface normal gets larger. For a 2D web interface when the user changes from the overhead imagery to the oblqiue views, the imagery could fade from one to the other.

[caption id="attachment_1179" align="aligncenter" width="600" caption="Sydney North Oblique viewed in Google Earth from a lower angle (not straight above). Image tiles from NearMap. Used under the http://www.nearmap.com/products/community-licence license."][/caption]

I hope to also get libchamplain to overlay transpanent map tiles on top of imagery (more on that in the next post), because I really think that oblique views make map reading much easier for the user (although the South, East and West can be a little confusing when viewed at high zooms on a 2D map, just like looking at the world map upside down can be a little confusing at first you just have to think a little bit harder to work out what your looking at, see South and East views further below).

[caption id="attachment_1181" align="aligncenter" width="600" caption="Sydney North Oblique Imagery from NearMap with OpenStreetMap tiles on top. OSM tiles and data CC-BY-SA 2.0 http://www.openstreetmap.org/, NearMap imagery http://www.nearmap.com/products/community-licence."][/caption]

[caption id="attachment_1182" align="aligncenter" width="600" caption="North Oblique Imagery from NearMap with OpenStreetMap tiles on top. OSM tiles and data CC-BY-SA 2.0 http://www.openstreetmap.org/, NearMap imagery http://www.nearmap.com/products/community-licence."][/caption]

[caption id="attachment_1183" align="aligncenter" width="600" caption="Sydney South Oblique View. Image tiles from NearMap. Used under the http://www.nearmap.com/products/community-licence license."][/caption]

[caption id="attachment_1184" align="aligncenter" width="600" caption="Sydney East Oblique View. Image tiles from NearMap. Used under the http://www.nearmap.com/products/community-licence license."][/caption]

Soon I'll post up some stuff about NearMap in libchamplain, and my plans to set up some kind of object recognition to find objects like zebra crossings, the yellow school zone rectangle, cars... from imagery for integration into OpenStreetMap.

Tags: geo, nearmap, osm.