15 June 2014

Simplifying shapefiles in MapShaper

Maps should be simple, simple to make and simple to use.

I simplify shape files to use them in Tableau but you can use them in other apps too.

Why should you do this?

Speaking in simple words Tableau draws maps by joining nodes with lines in order given by ShapeToTab. If there are many nodes Tableau has to work harder and performs slower. Besides that it is a great way of spending free time :)

==============================================
Here you can learn what simplifying geometries of shape files is.
==============================================
What you will need:
- a shapefile (I use a polygon shapefile, but with a line file it should be fine too),
- MapShaper http://www.mapshaper.org/ (it's free online tool),
- patience as it's a very complex process, lol just joking.


You enter the website and see this:


I suggest putting a tick next to 'prevent shape removal'. In this tutorial I use a shapefile of Ukrainian provinces and if I didn't mark this option Kiev would disappear, as the area of the province is the smallest on my map.


Select the shape file you want to work with.


Admire your map.



Select the level of simplifying. You can easily see the difference, the number of nods is smaller.


Double click on the map to enlarge it, now the comparison is more spectacular.

before

after


Save the map in the most convenient format, for usage in ShapeToTab and then Tableau I select shapefile.

You get these three files .dbf, .shp, .shx.


After opening the file in QGIS, I see that there is nothing interesting in the attribute table, instead of the names of the administrative districts there are only numbers. MapShaper appeared to be evil and deleted the names of the polygons. No reason to be worried, it's easy to fix.



Content of attribute table is stored in a .dbf file so copy the .dbf from the folder which stores the files that were input for MapShaper and add it to the folder consisting simplified geometry, delete the .dbf holding numbers.


Once more open your shape file in QGIS and celebrate success :)



2 comments:

  1. Спасибо! Я ранее пытался упрощать шейпы для Tableau через плагины для QGIS. А способ добавления своих карт с Tabgeohack вообще не работает с версии Tableau 8.2.

    ReplyDelete
  2. Спасибо, я добавлю что в Tableau 8.2. Tabgeohack не работает.
    Для упрощения шейпов я использую все ShapeToTab, QGIS (Vector=> Geometry Tools => Simplify geometries), MapShaper.

    ReplyDelete