Skip to main content

Creating a custom map tiling scheme for New Zealand’s seafloor

First of all I want to thank Brent Wood at National Insitute of Water & Atmospheric Research (NIWA) for inviting me to their office after writing my first blog post about seafloor mapping in New Zealand. Luckily I happened to be in Wellington where they are located, the best city in New Zealand (see photos below)! I was also fortunate to meet Kevin Mackay, the Marine Database Manager who’s responsible for the bathymetry dataset I’ve been using to create this map. You’ll be surprised about the amount of work and data needed to create a bathymetry dataset for such a large and hidden area of our planet. This mapping has been beneficial to New Zealand, as they have been able to claim rights to 1.7 million square kilometers of extended continental seabed, an area about six times New Zealand’s total land area.

In the last blog post we created a seafloor map of New Zealand using shading relief. The map image we created was very large, 12000 x 15200 pixels, with a resolution of 250 meters per pixel. To create an interactive web map we need to cut the image into tiles for a number of zoom levels.  As I’m using a custom map projection (Mercator 41), I also have to define a custom tiling scheme. This is my suggestion:


The red area shows the extent of the dataset. The yellow squares show the tiles for zoom level 0 to 2. The biggest square covers an area of 4,096,000 x 4,096,000 meters.  Data nerds will know that this number is easily divided by 256, the de facto size of map tiles in pixels. The tile area is defined by these bounds (left, bottom, right, top): 4200000, -6096000, 8296000, -2000000. This table shows the resolution and scale for all zoom levels: 


Zoom level 6 is maching the resolution of our dataset, 250 meters per pixel. We now have the information we need to define the tiling scheme in TileCache:

[nz-seafloor]
type=Mapnik
src=EPSG:3994
bbox=4200000,-6096000,8296000,-2000000
maxResolution=16000
mapfile=/home/turban/NZ/Bathymetry/nz-seafloor.xml

I’m not going into detail here, read more about how you can define custom tiling schemes with TileCache, Mapnik and Leaflet in this blog post. I’m using tilecache_seed.py to render the map tiles: 

tilecache_seed.py -f nz-seafloor 0 7

Next, we can use Leaflet to load the tiles into an interactive map:


This is what the map looks like:



Show fullscreen

----

A few photos from the best captial city in the world, Wellington:


Comments

Hamish said…
Hey Bjørn, it was great to catch up with you briefly while you were in Auckland. Are you going to have time to stop by to try some more local IPAs? :P

Great looking map! I noticed however that you're missing a few offshore islands. LINZ have a combined polygon layer here, that you should be able to drop in as a replacement for the mainland and island polys:

http://data.linz.govt.nz/#/layer/1153-nz-coastlines-and-islands-polygons-topo-150k/

Includes notably missing island groups like the Chathams.
Bjørn Sandvik said…
Hi Hamish,

It was nice meeting you, I would definately like to try some more IPAs if I'm passing by Auckland again!

Are the Chathams that important?!? ;-)
I was looking at the 1:50,000 dataset, but the large scale data didn't fit my small scale map. Do you know if the same dataset is available at 1:500,000 scale? I couldn't find island polygons for lower resolutions at the LINZ Data Portal, so the one I'm using is converted from a line dataset using QGIS.
Hamish said…
Heh, well they often get left off, and people don't usually notice. I guess because we always have to deal with horrible anti-meridian problems, I've become used to looking out for it. Nokia maps completely ignores them too :(

There are about a 1,000 people who live there, and they're reasonably sized islands (a little smaller than Steward Island to the south). The Auckland Islands further south are significant too, but again, they're commonly ignored and uninhabited.

No, doesn't look like there is a 1:500,000 version. I'll ask them if they'll put one together :)

Hamish
DR said…
There is error in table - map size sould be 512x512 instead 512x256.

Popular posts from this blog

Creating a WebGL Earth with three.js

This blog post will show you how to create a WebGL Earth with three.js , a great JavaScript library which helps you to go 3D in the browser. I was surprised how easy it seemed when reading a blog post  by Jerome Etienne . So I decided to give it a try using earth textures  from one of my favourite cartographers, Tom Patterson . WebGL is a JavaScript API for rendering interactive 3D graphics in modern web browsers without the use of plug-ins. Three.js is built on top of WebGL, and allows you to create complex 3D scenes with a few lines of JavaScript. If your browser supports WebGL you should see a rotating Earth below: [ Fullscreen ] To be able to display something with three.js, you need three things: a scene, a camera and a renderer. var width  = window.innerWidth,     height = window.innerHeight; var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(45, width / height, 0.01, 1000); camera.position.z = 1.5; var rende...

Thematic Mapping Engine

It's time to introduce the Thematic Mapping Engine (TME). In my previous blog posts, I've shown various techniques of how geobrowsers can be used for thematic mapping. The goal has been to explore the possibilites and to make these techniques available to a wider audience. The Tematic Mapping Engine provides an easy-to-use web interface where you can create visually appealing maps on-the-fly. So far only prism maps are supported, but other thematic mapping techniques will be added in the upcoming weeks. The engine returns a KMZ file that you can open in Google Earth or download to your computer. My primary data source is UNdata . The above visualisation is generated by TME ( download KMZ ) and shows child mortaility in the world ( UNdata ). The Thematic Mapping Engine is also an example of what you can achieve with open source tools and datasets in the public domain: A world border dataset is loaded into a MySQL database . The same database contains tables with statistics ...

Creating 3D terrains with Cesium

Previously, I’ve used three.js to create 3D terrain maps in the browser ( 1 , 2 , 3 , 4 , 5 , 6 ). It worked great for smaller areas, but three.js doesn’t have built-in support for tiling and advanced LOD algorithms needed to render large terrains. So I decided to take Cesium for a spin. Cesium is a JavaScript library for creating 3D globes and 2D maps in the browser without a plugin. Like three.js, it uses WebGL for hardware-accelerated graphics. Cesium allows you to add your own terrain data, and this blog post will show you how. Impressed by the terrain rendering in @CesiumJS - with a 10m elevation model for Norway! Farewell Google Earth. pic.twitter.com/RQKvfu2hBb — Bjørn Sandvik (@thematicmapping) October 4, 2014 Compared to  the dying Google Earth plugin , it's quite complicated to get started with Cesium. The source code is well documented and the live coding Sandcastle is great, but there is a lack of tutorials  and my development slows down when ...