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.

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,

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.

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

]]>https://andrewharvey4.wordpress.com/2011/12/11/development-update-static-osm-tiles-git-rebase-map-labelling/feed/0andrewharvey4OSMThttps://andrewharvey4.wordpress.com/2011/10/09/osmt/
https://andrewharvey4.wordpress.com/2011/10/09/osmt/#respondSun, 09 Oct 2011 07:00:40 +0000http://andrewharvey4.wordpress.com/?p=1327I 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.

]]>https://andrewharvey4.wordpress.com/2011/10/09/osmt/feed/0andrewharvey4All Roads Lead to Packaging for Debianhttps://andrewharvey4.wordpress.com/2011/09/12/all-roads-lead-to-packaging-for-debian/
https://andrewharvey4.wordpress.com/2011/09/12/all-roads-lead-to-packaging-for-debian/#commentsMon, 12 Sep 2011 11:32:22 +0000http://andrewharvey4.wordpress.com/?p=1316Just 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.

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…

]]>https://andrewharvey4.wordpress.com/2011/09/12/all-roads-lead-to-packaging-for-debian/feed/1andrewharvey4Using TileMill to make OpenStreetMap Map Stylesheetshttps://andrewharvey4.wordpress.com/2011/06/06/using-tilemill-to-make-openstreetmap-map-stylesheets/
https://andrewharvey4.wordpress.com/2011/06/06/using-tilemill-to-make-openstreetmap-map-stylesheets/#commentsMon, 06 Jun 2011 12:20:32 +0000http://andrewharvey4.wordpress.com/?p=1305A 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,

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…

]]>https://andrewharvey4.wordpress.com/2011/06/06/using-tilemill-to-make-openstreetmap-map-stylesheets/feed/1andrewharvey4tilemill-style1tilemill-syd-drainageUsing ABS ASGS Data in OpenStreetMaphttps://andrewharvey4.wordpress.com/2011/03/17/using-abs-asgs-data-in-openstreetmap/
https://andrewharvey4.wordpress.com/2011/03/17/using-abs-asgs-data-in-openstreetmap/#commentsThu, 17 Mar 2011 11:18:21 +0000http://andrewharvey4.wordpress.com/?p=1288A 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.

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.

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.

]]>https://andrewharvey4.wordpress.com/2011/03/17/using-abs-asgs-data-in-openstreetmap/feed/3andrewharvey4asgs-abs-structuresasgs-non-abs-structuresnearmap-asb-mb-in-josmUsing XSLT to Transform XML data into OSM formathttps://andrewharvey4.wordpress.com/2011/02/14/using-xslt-to-transform-xml-data-into-osm-format/
https://andrewharvey4.wordpress.com/2011/02/14/using-xslt-to-transform-xml-data-into-osm-format/#commentsMon, 14 Feb 2011 10:46:03 +0000http://andrewharvey4.wordpress.com/?p=1270For 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.

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,

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.

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).

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.”

]]>https://andrewharvey4.wordpress.com/2011/02/14/using-xslt-to-transform-xml-data-into-osm-format/feed/2andrewharvey4OSM user history heatmaphttps://andrewharvey4.wordpress.com/2011/01/16/osm-user-history-heatmap/
https://andrewharvey4.wordpress.com/2011/01/16/osm-user-history-heatmap/#commentsSun, 16 Jan 2011 10:06:23 +0000http://andrewharvey4.wordpress.com/?p=1245In 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.

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.

Heat map image of my created or modified nodes in OpenStreetMap

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.

]]>https://andrewharvey4.wordpress.com/2011/01/16/osm-user-history-heatmap/feed/1andrewharvey4osmchange-heatmapOld Maps Onlinehttps://andrewharvey4.wordpress.com/2010/11/28/old-maps-online/
https://andrewharvey4.wordpress.com/2010/11/28/old-maps-online/#commentsSun, 28 Nov 2010 06:38:53 +0000http://andrewharvey4.wordpress.com/?p=1228I 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.

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.

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.

]]>https://andrewharvey4.wordpress.com/2010/11/28/old-maps-online/feed/5andrewharvey4oldmap-on-osmmapnik-in-openlayersoldmap-in-josmoldmap-on-osmmapnik-in-openlayers2Slippy Map Tilenames For Non-North [Isometric] Web Mapshttps://andrewharvey4.wordpress.com/2010/11/28/slippy-map-tilenames-for-non-north-isometric-web-maps/
https://andrewharvey4.wordpress.com/2010/11/28/slippy-map-tilenames-for-non-north-isometric-web-maps/#commentsSun, 28 Nov 2010 04:01:19 +0000http://andrewharvey4.wordpress.com/?p=1226I 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.