Jason Magee

A while ago now, Digimap gave data.gg a SHP file containing elevation data for Guernsey, Sark, Alderney and Herm. Using this data, I’m going to place a WebGL widget on data.gg allowing users to fly around the islands. There’s two ways to approach this:

This post is going to be about the latter method which is to create a mesh. I’ll do a separate post about the other method in the future. Both approaches have different pros and cons—the mesh approach may be more detailed, while game engines (which is ultimately what the WebGL widget will be) will handle terrain better performance-wise.

To create the mesh I’m going to be using Blender , an awesome open-source 3D graphics editor. You’ll also want to grab an add-on called BlenderGIS , which is a “bridge between Blender and geographic data.”

Import

Using the menu, import your SHP file. Note that the ability to import SHP files comes from the BlenderGIS add-on.

Image

These options will appear. The field holding the elevation in my case is called ZVALUE.

Image

Point Cloud

Depending on your data size, this could take a while, but eventually the add-on will do its job and create vertices for all the XYZ coordinates.

Image

What you have here is known as a point cloud. There are loads of tools and algorithms to triangulate point clouds into meshes, but BlenderGIS comes with one called ‘Delaunay,’ which worked perfectly for me. It’s in the tools area (press T) under the ‘GIS’ tab.

Image

Mesh

Again—this could take a while depending on your data size, but eventually you’ll be presented with a mesh containing edges and faces. Due to my data set containing rock formations around the islands, it has created some planes joining the rocks to the island and other rocks. Select one of the planes and press Ctrl-Shift-Alt-F to select all linked flat faces as in the screenshot below. Use X to delete these faces.

Image

There we have it. One mesh.

Image

I have a large data set, so my mesh has 433,775 faces, which is too many to be usable. There are a couple of ways to simplify a mesh, but I found using the ‘Decimate’ modifier with a collapse ratio of 0.03 produced good results. Below I’ve reduced the mesh to 5,987 faces.

Image