Following es-atlas, it made sense to create some scripts to convert the vector data from Madrid and Barcelona.
These two projects provide all the basic administrative divisions of Madrid and Barcelona in just one TopoJSON, ready to use with D3 and your data. Census tracts, neighborhoods, districts, no problem!
In the end this means that you shouldn’t specify a projection while making the map. The calculations are already done and the rendering is faster.
Download the zip or clone the Madrid or the Barcelona repo, go to the folder with your terminal and run
npm install. The script will start downloading the files and converting them. In the end you’ll find the output in the
barcelona folder, respectively.
I am also maintaining two URLs with the files:
¿Open data? Not in Barcelona
The Barcelona City Council has a platform that hosts all the geographic data of the city, CartoBCN. This shouldn’t be a problem if they provided public URLs, of at least the basic administrative divisions. Instead, they only let you download the datasets after registering in a marketplace-like interface.
To circumvent this, I had to create a public mirror of the data.
I already contacted them, but I haven’t gotten any response yet.
Thanks to Luis Sevillano for helping with the Madrid script.