Alteryx / Mapbox

2018-02-28

First, let me start with a confession. I’m obsessed with maps, cartograms and diacartograms! There is something magical about them. They takes us to places we’ve never seen before. They are beautiful, interesting and provocative works of art.

Maarten Lambrechts‏ @maartenzam made a map with 1 dot for every inhabitant of Belgium.

Here is his blog post: One person one dot

When I saw that I knew I want to try something similar.

DATA

Last year I made a Dog Map for Hungary. It was published in a Hungarian internet portal: Dog map with a Name searching viz. You can check it if you know any Hungarian dog name 😊 https://dataviz.love/dognames.html

I used that data to take my dog dot density map, but I didn’t want to use the full dataset therefore I decided to show the dogs who lives in Budapest only. The second dataset was a shapefile for the districts.

Let’s do it

Maarten’s used QGIS, therefore, I also downloaded the program. Honestly, I had never used QGIS before. I tried to follow Maarten’s steps but I got so confused at the beginning thus I gave it up and opened Alteryx.

The first thing I did to connect the 2 datasets (dogs with the district.shp) together based on the districts as a key field. Now, I had the complete dataset which contains the dogs with Polygons.

The hardest part came after that. How can I generate random points inside the polygons of districts? QGIS has an own menu for the process but in Alteryx this step is a bit more complicated.

Béla one of my colleagues who is the best in Alteryx helped me out. First, he computed the Areas(square km) of the polygons then generated grids for each Objects. At this time we realized that significant areas have disappeared in districts. You should know that some districts of Budapest are smaller than others so we had to handle the issue of different areas.

We made two grid sizes depending if the district is smaller or larger than 10 square km. If smaller the grid size was 0.001 kms, if larger the grid size was 0.02 kms. Then we used union all of these two options.

After this action Béla looked for the centroid of the districts as X and Y fields then made a Rand() number as a sorter. Our goal was to have as many points as dogs in the districts and all this should be at random.

Therefore we randomly sorted the data then we generated an ascending sequence for all districts which was then used in the filter.

[row_id] <= [Sum_Number of records/dogs]

Finally, we created points from the randomized data and the result is here: One dog one dot on Mapbox 🙂 There is no question that more dogs live in flats than in family houses.

Click on a dot on the map.



Cheers,

Ivett