Skip to main content

Posts

Showing posts with the label QGIS

Converting shapefiles to TopoJSON + a GitHub secret

This blog post will show you how to convert shapefiles to TopoJSON . We'll convert the two shapefiles we created in my previous blog post , containing all counties and municipalities of Norway. In a blog post from November last year I looked at various strategies to minify GeoJSON files . TopoJSON is an extension of GeoJSON that encodes topolog (e.g. shared borders between counties and municipalities). Polygons and lines in TopoJSON are represented by stiching together shared line segments. The shared boundary between two municipalities are represented only once, reducing the file size. Counties and municipalities are also sharing the same borders, and TileJSON are capeable of keeping both features in a single file. I won't go into detail, as the format is  very well explained on this page . Our shapefiles are using the Universal Transverse Mercator (UTM) 33N projection , a common projection for maps covering mainland Norway. If you want to keep this coordinate system in ...

Splitting and clipping shapefiles with QGIS

In my last blog post , we improved a dataset containing all municipalities of Norway by merging polygons in QGIS. The municipality polygons include the sea areas, which makes it harder for people to recognize the shapes, as we're used to see Norway with all its fjords and islands. So let's use QGIS to remove the sea from all municipalities. This is a two-step process. First we need to create a shapefile containing only sea areas. Let's open "NO_Arealdekke_pol.shp" in QGIS. This file contains land cover data, where one of the categories is sea areas ("Havflate").   Open the attribute table and select all sea areas (OBJTYPE = Havflate).   While the areas are selected, right-click on the layer name in the left column and select "Save Selection As...". Save the shapefile with a new name ("NO_Havflate_pol.shp").  Open the new shapefile and click the "Toggle Editing" button. Mark all sea areas with "Select Fea...

Merging polygons in QGIS

I'm going to play with the mapping capabilitites of D3.js in my new blog series from Foldøy island. I would like to use data from my own country, Norway. This dataset needs some improvements, and this blog post will show you how to do merge polygons in QGIS . As announced in an earlier blog post, Norway will open it's topographic datasets to the public . This week we got some details about the launch: The data will be released on October 1st this year, The licence will be CC BY 3.0 . Vector- and rasterdata at various scales up to 1:50,000 will be available.  This includes administrative borders for counties and municipalities  and driveable roads longer that 50 meters.  Digital elevation data at 10x10 meter resolution, which is great news! Before October 1st, I'm stuck with a dataset at 1:2,000,000 scale, but it will be suitable for country-wide mapping with D3.js. You can download the shapefiles from the Norwegian Mapping Authority on this page ....

Mapping the population density of New Zealand with QGIS, SQLite and TileMill

There are over 4.4 million people living in New Zealand, but they’re not evenly distributed across the country. On my travels, I’ve been to some very remote areas like Doubtful Sound in Fjordland with a permanent population of one! Where do the New Zealanders live? Let’s create a population density map of New Zealand. Doubtful Sound According to Lonely Planet , 63% of New Zealanders live on the North Island, 20% on the South Island, 10% in Australia, 5% in the rest of the world, and 2% are travelling! The area of New Zealand is 268,021 km2 (Norway has 385,252 km2), which means there are about 16.5 New Zealanders per km2. Norwegians have a bit more space, we're only 15.5 persons per km2. Auckland I want to map the population density as a choropleth map , using darker colors for higher densities. But which units or geographical areas should I use? The regions (territorial authorities) I mapped in my last blog post are too big to show the population density of the c...

Mapping New Zealand: Creating a road map

I’ve travelled around New Zealand by bus, car, boat, and by foot. In a previous blog post , I created a “Where I’ve Been Map” using markers for each of the places I’ve stayed. Let’s add some lines showing the route between the markers. I've destroyed my National Geographic map while travelling around the New Zealand. How can I add the roads travelled to my digital map? Travelling around New Zealand can be quite an experience. This is a well known sight. I’ll concentrate on the roads in this post, and deal with boat and foot tracks later. As I didn’t carry a GPS when travelling by bus or car, I had to find the road lines from a different source. I’m using road data from LINZ for my map, but I’m sure you can achieve the same with OpenStreetMap data. First, I created an empty shapefile in QGIS for my road data. Then I marked and copied the roads I’ve travelled from the LINZ shapefile, and pasted the road segments into my own shapefile. I also had to cut road lines ...