Skip to content

Commit ba09d82

Browse files
author
Martín González
committed
update the files
1 parent 4067f93 commit ba09d82

File tree

13 files changed

+1450
-3
lines changed

13 files changed

+1450
-3
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
bcn-geodata
22
========
3-
Converted from SHP with QGIS.
3+
The official shapefiles from Barcelona, converted to GeoJSON and TopoJSON for making your life easier.
44

5+
## Recreate the files
6+
- Go to the [CartoBCN](http://w20.bcn.cat/cartobcn/) website and make an account. After that, to click on `Catàleg` and select the SHP we are going to use, `ED50. DIVISIONS ADMINISTRATIVES en format CAD/SHP/KMZ`.
7+
8+
- Extract the zip and extract the `BCN_DIVADM_ED50_SHP.ZIP` zip again. We have five different files, first, the basic statistic area, then `Àrea d'interès`, which is an area important for statistic purposes (covers zones that are useful for calculating stuff), after that the neighbourhoods, the districts and the census area. We will first convert the shapefiles to GeoJSON, using the `ogr2ogr` tool. [A good tutorial](http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/) if you don't know what I'm talking about. Let's go!
9+
10+
```bash
11+
ogr2ogr -f GeoJSON \
12+
-t_srs crs:84 \
13+
output.geojson \
14+
NAME_OF_YOUR_SHAPEFILE.shp
15+
```
16+
You can convert all the shapefiles that are interesting for you through this way.
17+
18+
- After that you will notice that the result is not particularly small, a problem if you want to use it on a web map. Now we are going to use TopoJSON, a format that can reduce the size up to a 85%! Install TopoJSON with `npm` (`npm install -g topojson`) and use this snippet:
19+
20+
```bash
21+
topojson -o output.topo.json \
22+
NAME_OF_YOUR.geojson \
23+
-p barri=N_Barri,codi=C_Barri
24+
```
25+
In this case I'm using the BCN_Barri_ED50_SHP.shp file. Using the `p` option I tell TopoJSON to preserve the name of the neighbourhood and its code, and rename them to `nom` and `codi`. You can adapt this to your needs looking at the GeoJSON properties of each file.
26+
27+
Congrats! Now you have a set of TopoJSONs ready to visualize! Look at [their command line reference](https://github.com/mbostock/topojson/wiki/Command-Line-Reference) for more powerful options.
528

629
Source: Ajuntament de Barcelona / [CartoBCN](http://w20.bcn.cat/cartobcn/). License: CC-BY.

area-estadistica/area-estadistica.geojson

Lines changed: 240 additions & 0 deletions
Large diffs are not rendered by default.

area-estadistica/area-estadistica.topo.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

area-interes/area-interes.geojson

Lines changed: 9 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"type":"Topology","objects":{"area-interes":{"type":"GeometryCollection","crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}},"geometries":[{"type":"Polygon","properties":{"nom":"Parc de Montjuïc"},"arcs":[[0,1]]},{"type":"Polygon","properties":{"nom":"Zona Franca"},"arcs":[[-1,2]]}]}},"arcs":[[[8817,9043],[-30,-173],[-26,-111],[-40,-65],[-59,-106],[-52,-108],[-18,-42],[-26,-65],[-3,-7],[-3,-10],[-4,-9],[-2,-7],[-3,-7],[-2,-5],[-1,-4],[-3,-8],[-3,-8],[-4,-10],[-4,-10],[-3,-9],[-4,-8],[-3,-8],[-3,-7],[-2,-7],[-3,-7],[-1,-4],[-3,-6],[-2,-5],[-3,-8],[-2,-4],[-2,-4],[-4,-9],[-3,-8],[-4,-7],[-3,-7],[-1,-3],[-3,-5],[-2,-6],[-4,-7],[-4,-8],[-4,-7],[-4,-8],[-2,-5],[-2,-3],[-1,-3],[-4,-7],[-3,-6],[-5,-9],[-5,-9],[-4,-8],[-4,-8],[-5,-8],[-4,-8],[-4,-9],[-5,-9],[-2,-5],[-4,-6],[-3,-6],[-4,-8],[-4,-7],[-4,-7],[-3,-7],[-4,-8],[-4,-7],[-4,-7],[-3,-6],[-4,-8],[-4,-7],[-2,-4],[-4,-6],[-3,-6],[-3,-5],[-3,-8],[-4,-8],[-5,-8],[-4,-7],[-6,-12],[-6,-12],[-5,-9],[-5,-10],[-5,-8],[-4,-9],[-5,-9],[-4,-9],[-6,-9],[-2,-5],[-3,-5],[-4,-8],[-5,-8],[-3,-6],[-4,-7],[-2,-3],[-2,-5],[-3,-5],[-3,-5],[-2,-3],[-4,-8],[-4,-6],[-5,-7],[-4,-7],[-2,-3],[-3,-4],[-2,-4],[-4,-5],[-4,-6],[-4,-5],[-4,-6],[-5,-7],[-3,-3],[-2,-3],[-3,-3],[-3,-5],[-4,-4],[-6,-7],[-2,-3],[-3,-3],[-4,-5],[-6,-6],[-5,-6],[-6,-6],[-3,-3],[-3,-3],[-5,-6],[-5,-5],[-7,-7],[-8,-8],[-6,-6],[-6,-6],[-5,-6],[-5,-5],[-6,-6],[-6,-6],[-10,-9],[-9,-10],[-7,-6],[-6,-7],[-8,-8],[-8,-8],[-10,-9],[-9,-10],[-8,-7],[-7,-8],[-6,-6],[-6,-6],[-7,-7],[-7,-8],[-4,-3],[-5,-5],[-5,-5],[-7,-8],[-8,-8],[-7,-6],[-6,-7],[-3,-2],[-7,-7],[-10,-10],[-7,-7],[-8,-7],[-5,-5],[-7,-7],[-8,-7],[-9,-8],[-10,-9],[-8,-7],[-4,-4],[-5,-4],[-8,-7],[-9,-7],[-11,-9],[-10,-9],[-10,-9],[-11,-8],[-9,-8],[-9,-7],[-5,-5],[-4,-3],[-5,-5],[-6,-5],[-8,-7],[-8,-8],[-8,-8],[-8,-7],[-8,-8],[-4,-3],[-4,-4],[-5,-5],[-8,-8],[-8,-8],[-9,-9],[-9,-9],[-10,-10],[-10,-10],[-10,-10],[-9,-10],[-11,-11],[-11,-11],[-10,-11],[-10,-10],[-10,-10],[-11,-11],[-5,-5],[-7,-7],[-2,-2],[-8,-8],[-15,-17],[-16,-16],[-5,-5],[-4,-5],[-7,-8],[-6,-7],[-5,-6],[-5,-6],[-5,-5],[-2,-2],[-2,-3],[-3,-3],[-3,-4],[-4,-5],[-6,-7],[-6,-7],[-5,-6],[-5,-6],[-4,-5],[-2,-3],[-1,-1],[-2,-2],[-5,-6],[-5,-7],[-8,-10],[-8,-9],[-6,-8],[-16,-19],[-3,-5],[-2,-3],[-2,-2],[-4,-4],[-2,-4],[-6,-7],[-5,-7],[-4,-4],[-7,-9],[-7,-9],[-4,-5],[-8,-11],[-6,-7],[-3,-4],[-3,-3],[-6,-8],[-5,-7],[-4,-5],[-7,-9],[-10,-12],[-5,-6],[-4,-6],[-3,-3],[-4,-6],[-4,-4],[-6,-8],[-5,-7],[-3,-3],[-3,-3],[-5,-7],[-4,-5],[-2,-3],[-5,-6],[-6,-7],[-2,-4],[-6,-7],[-5,-7],[-8,-9],[-3,-5],[-5,-6],[-2,-3],[-4,-4],[-5,-7],[-4,-5],[-2,-2],[-3,-4],[-3,-4],[-5,-7],[-4,-5],[-8,-10],[-5,-7],[-3,-3],[-5,-7],[-5,-6],[-9,-13],[-7,-8],[-3,-4],[-5,-7],[-5,-6],[-3,-3],[-2,-3],[-83,-109],[-99,-106],[-76,-76],[-54,-47],[-44,-35],[-61,-42],[-63,-33],[-70,-32],[-30,-11],[-62,-16],[-79,-9],[-56,-1],[-43,4],[-3,1],[-9,1],[-9,2],[-8,2],[-8,3],[-7,1],[-27,18],[-9,6]],[[6220,6018],[-13,9],[-90,58],[-58,13],[-46,4],[-69,50],[-209,154],[-77,60],[-101,63],[-61,59],[-14,46],[-11,26],[-17,42],[-1,4],[-1,1],[0,2],[-1,2],[0,1],[0,1],[-1,1],[0,2],[0,1],[-1,2],[0,1],[-1,2],[0,2],[-1,1],[0,3],[-1,1],[0,3],[-1,1],[0,2],[0,1],[-1,3],[-1,2],[0,1],[0,2],[-1,2],[0,1],[0,1],[-1,2],[0,3],[0,1],[-1,1],[0,1],[0,1],[0,2],[-1,2],[0,1],[0,2],[-1,1],[0,1],[0,1],[0,1],[0,2],[0,1],[-1,1],[0,2],[0,2],[0,1],[-4,15],[-7,23],[-8,20],[-8,18],[-10,19],[-13,13],[6,13],[-8,10],[-16,21],[-22,28],[-13,16],[-10,13],[-6,9],[-8,13],[-5,10],[-4,7],[-4,10],[-5,12],[-3,10],[-3,10],[-2,10],[-2,13],[-2,14],[-1,13],[0,11],[0,11],[0,11],[1,7],[0,21],[1,23],[0,7],[0,9],[-1,11],[-2,11],[-4,19],[-9,22],[76,60],[5,4],[4,3],[6,5],[5,4],[3,2],[4,3],[3,2],[1,1],[2,2],[2,1],[1,1],[2,2],[4,3],[3,2],[5,4],[4,4],[3,2],[3,3],[3,1],[1,1],[1,1],[2,1],[1,1],[1,2],[1,0],[2,1],[1,1],[1,1],[1,1],[1,0],[1,1],[1,1],[4,2],[1,1],[1,1],[1,0],[1,1],[1,0],[1,1],[1,0],[1,1],[1,0],[0,1],[1,0],[1,1],[1,0],[1,0],[1,1],[1,1],[1,0],[2,1],[1,0],[1,1],[1,0],[0,1],[2,0],[0,1],[1,0],[1,0],[1,1],[1,0],[1,1],[1,0],[1,0],[1,1],[1,0],[2,1],[1,0],[1,1],[1,0],[1,1],[1,0],[1,0],[1,1],[1,0],[1,0],[1,1],[1,0],[1,0],[1,1],[1,0],[1,0],[2,1],[1,0],[1,0],[2,1],[1,0],[1,0],[0,1],[2,0],[1,0],[1,0],[1,1],[1,0],[1,0],[1,0],[1,1],[1,0],[1,0],[1,0],[1,0],[1,1],[1,0],[2,0],[1,0],[2,1],[2,0],[1,0],[1,0],[7,1],[1,0],[1,0],[2,0],[1,1],[1,0],[1,0],[1,0],[1,0],[1,0],[2,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[2,0],[1,0],[1,0],[1,0],[1,0],[1,-1],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,-1],[1,0],[1,0],[1,0],[2,0],[1,0],[1,-1],[1,0],[1,0],[1,0],[1,0],[1,0],[1,-1],[2,0],[2,0],[1,-1],[1,0],[1,0],[1,0],[1,0],[1,-1],[1,0],[1,0],[1,0],[1,-1],[1,0],[1,0],[1,-1],[1,0],[1,0],[1,0],[1,-1],[1,0],[1,0],[1,-1],[2,0],[2,-1],[1,0],[3,-1],[3,-1],[2,-1],[2,0],[4,-2],[4,-1],[3,-1],[2,-1],[6,-2],[5,-1],[9,-3],[13,-5],[7,-2],[2,-1],[3,-1],[2,-1],[7,-2],[10,-3],[12,-3],[9,-2],[13,-3],[11,-2],[9,-2],[11,-1],[20,1],[16,6],[13,11],[17,23],[9,22],[2,22],[1,23],[0,21],[-2,19],[-2,22],[-5,12],[-5,16],[-6,15],[-6,14],[-1,4],[-4,8],[-3,8],[-4,8],[-6,12],[-10,19],[-8,13],[-8,13],[-9,13],[-9,12],[-21,25],[-22,24],[-22,23],[-23,23],[-6,6],[-53,48],[1,0],[-2,1],[-2,1],[-2,2],[-13,9],[-13,8],[-13,8],[-14,7],[-11,6],[-11,6],[-11,5],[-7,3],[-7,4],[-7,3],[-7,4],[-27,12],[-32,13],[-28,12],[-40,16],[-4,2],[-4,2],[-12,6],[-12,7],[-25,14],[-21,13],[-18,10],[-25,15],[-13,8],[-11,6],[-16,16],[-50,55],[-6,8],[-10,11],[-8,9],[-7,8],[-6,6],[-6,6],[-5,6],[-5,4],[-6,5],[-25,16],[-16,11],[3,4],[2,2],[16,20],[-27,24],[-2,1],[-15,13],[-22,21],[-2,2],[-4,3],[-2,2],[-32,29],[-8,-11],[-3,3],[-3,3],[-2,2],[-3,3],[-3,2],[-1,3],[0,3],[1,2],[9,15],[5,11],[5,15],[2,23],[3,33],[22,-2],[21,40],[38,72],[1,0],[2,0],[10,-4],[1,4],[5,19],[8,19],[10,26],[1,4],[3,5],[4,2],[11,1],[0,4],[0,7],[1,9],[1,6],[2,6],[1,6],[2,6],[3,6],[3,5],[3,6],[7,9],[7,9],[8,9],[9,8],[8,7],[8,6],[104,67],[4,3],[6,4],[66,45],[9,7],[2,12],[1,4],[2,5],[1,4],[1,4],[2,5],[2,6],[3,5],[4,7],[3,6],[4,6],[3,5],[6,7],[3,4],[2,3],[1,1],[36,33],[4,3],[20,12],[20,11],[21,9],[35,9],[7,2],[9,2],[14,2],[15,1],[13,0],[13,0],[14,-1],[19,-2],[18,-3],[11,-2],[17,-2],[13,-2],[13,-2],[16,1],[2,0],[12,1],[13,3],[11,4],[11,4],[7,4],[7,5],[9,6],[8,7],[12,12],[7,9],[4,8],[3,5],[6,14],[4,11],[4,16],[2,13],[4,17],[2,15],[4,20],[1,9],[2,10],[2,11],[1,8],[2,11],[4,12],[5,10],[4,6],[11,12],[14,10],[75,43],[-39,42],[-195,204],[-155,163],[42,44],[116,123],[-11,92],[76,80],[38,-35],[32,-18],[21,-12],[85,-49],[128,0],[299,-1],[70,-177],[-28,-16],[-3,6],[-6,-4],[3,-6],[-6,-4],[-20,-10],[-3,6],[-18,-9],[9,-20],[16,-33],[16,-33],[17,-35],[0,-1],[2,-1],[2,-1],[2,0],[1,1],[2,1],[2,0],[2,0],[2,0],[1,-1],[1,-2],[11,-23],[-136,-73],[164,-334],[5,-7],[6,-5],[6,-5],[8,-3],[1,0],[2,0],[2,0],[4,0],[3,0],[4,0],[4,1],[3,1],[4,1],[9,2],[8,2],[9,2],[9,2],[9,1],[8,0],[9,0],[9,0],[8,-1],[9,-1],[8,-1],[8,-2],[8,-3],[80,-22],[11,-2],[10,-2],[11,-1],[7,-1],[6,0],[7,-1],[7,0],[7,0],[7,0],[6,1],[6,0],[15,0],[8,1],[9,0],[9,0],[6,-1],[6,0],[6,-1],[6,-1],[6,-1],[3,-1],[34,-8],[7,18],[2,6],[2,5],[2,5],[0,1],[4,8],[4,8],[5,8],[4,7],[5,10],[6,10],[7,12],[10,-10],[20,-27],[7,5],[6,5],[3,2],[12,-13],[2,-2],[4,-6],[12,-14],[-1,0],[-14,-8],[-12,-7],[4,-8],[-4,-4],[-8,-8],[-16,-15],[26,-15],[15,-9],[11,-6],[10,-6],[18,-10],[16,-9],[8,-4],[7,-4],[9,-5],[6,11],[35,-52],[15,-28],[4,-1],[13,-3],[7,4],[4,-9],[3,-11],[-2,-19],[-4,-9],[-5,-8],[14,-35],[28,4],[42,24],[-1,2],[35,25],[11,8],[7,5],[29,-44],[17,4],[14,3],[12,1],[15,2],[16,2],[25,2],[32,0],[11,0],[15,0],[81,84],[0,20],[3,10],[10,-2],[6,0],[14,14],[3,3],[3,3],[4,5],[14,15],[3,-2],[53,56],[31,33],[3,3],[3,3],[10,11],[3,3],[8,9],[16,-15],[0,-2],[1,-3],[1,-3],[1,-2],[1,-4],[1,-3],[2,-4],[2,-3],[2,-4],[2,-3],[2,-3],[3,-3],[3,-2],[2,-2],[3,-2],[3,-2],[3,-2],[4,-2],[3,-1],[4,-1],[4,-1],[4,0],[3,0],[3,0],[3,1],[3,0],[3,1],[3,1],[3,2],[3,1],[3,2],[2,2],[3,2],[2,3],[2,2],[28,34],[4,5],[6,5],[5,4],[5,3],[2,1],[5,3],[1,1],[50,23],[3,1],[2,0],[4,1],[4,0],[4,-1],[4,0],[4,-1],[4,0],[2,-1],[3,-1],[3,-2],[3,-1],[4,-3],[3,-2],[8,-5],[10,-7],[13,-9],[3,-2],[2,-1],[2,-1],[3,-1],[3,-1],[9,-4],[6,-2],[5,-2],[4,0],[11,-2],[10,-1],[7,0],[3,-1],[5,1],[4,0],[6,1],[5,0],[5,1],[6,1],[6,2],[7,1],[9,2],[6,1],[1,0],[18,4],[11,2],[4,1],[25,5],[17,3],[13,3],[13,3],[14,3],[3,0],[3,1],[2,1],[3,1],[3,1],[2,1],[2,1],[2,1],[2,2],[1,1],[4,2],[3,2],[3,1],[4,2],[3,1],[4,1],[38,9],[21,6],[1,0],[1,0],[1,0],[1,1],[1,0],[1,1],[1,0],[1,1],[1,1],[1,1],[0,1],[1,1],[1,1],[0,1],[1,1],[0,1],[0,1],[2,6],[1,3],[2,2],[2,1],[28,8],[124,29],[28,-120],[25,7],[33,8],[20,-94],[30,3],[-6,102],[35,8],[-1,-21],[1,-14],[0,-14],[0,-30],[3,0],[7,1],[-1,23],[0,31],[-1,13],[2,33],[0,8],[1,31],[1,-1],[32,-5],[34,-4],[-1,-4],[0,-3],[-1,-5],[-1,-8],[-19,-135],[7,-1]],[[8817,9043],[8,-2],[2,4],[-1,0],[3,9],[2,7],[2,6],[3,7],[5,11],[1,-1],[1,3],[-10,4],[4,6],[40,70],[6,-4],[14,23],[2,-1],[8,14],[1,1],[0,1],[1,1],[1,2],[1,0],[0,2],[1,0],[1,1],[1,1],[1,1],[1,1],[1,1],[1,0],[0,1],[1,0],[1,1],[2,1],[1,0],[14,8],[4,1],[6,10],[8,12],[13,21],[0,1],[-5,4],[6,10],[1,-1],[1,0],[2,1],[1,0],[1,1],[0,1],[1,0],[133,232],[11,17],[8,15],[55,-35],[-1,-17],[8,-6],[87,-55],[2,-10],[-22,-40],[-40,5],[-37,-375],[43,-6],[-11,-93],[-43,5],[-33,-320],[38,-4],[-22,-49],[373,-189],[18,41],[130,-69],[-40,-85],[217,-110],[4,10],[56,16],[-14,54],[62,19],[16,-74],[-21,-6],[28,-114],[18,-152],[-46,-12],[-468,-1026],[-238,-512],[-156,-368],[1,-69],[-19,-46],[-60,-100],[-20,-77],[-403,-2601],[-241,-1453],[388,-1596],[-102,-28],[-385,1602],[247,1494],[-169,28],[69,440],[-74,12],[287,1844],[-43,8],[8,44],[7,26],[19,41],[39,-20],[307,662],[-32,16],[28,59],[31,-17],[363,787],[-37,21],[30,67],[39,-20],[460,996],[-217,110],[-125,-274],[-52,27],[35,75],[-391,198],[-320,-586],[415,-214],[-160,-345],[-549,282],[-120,-261],[386,-362],[-694,-1473],[-30,16],[38,80],[-511,482],[-21,-8],[-71,114],[-132,-88],[17,-29],[-13,-9],[541,-896],[-65,-43],[-448,740],[-160,-107],[45,-76],[-45,-30],[140,-232],[-1005,-802],[-51,11],[30,290],[-44,5],[18,187],[-251,33],[-30,-275],[-123,-1278],[-481,-20],[2,-44],[-42,20],[-120,-271],[365,-179],[-175,-396],[30,-14],[-22,-51],[308,-150],[879,1992],[426,270],[180,-97],[720,-164],[-101,-320],[-100,22],[-705,-2238],[-82,3],[42,132],[-512,4],[-23,-113],[-77,1],[-17,-84],[-33,-118],[-32,-133],[-28,-138],[-61,-207],[62,-31],[-49,-114],[-68,34],[-115,-264],[-1236,101],[-1043,-56],[-470,68],[-204,44],[-340,90],[-408,119],[-504,193],[-281,205],[-148,317],[-319,499],[-8,-1],[-145,165],[-90,142],[-140,175],[-147,171],[-281,221],[-62,29],[-109,70],[-102,83],[139,90],[110,43],[285,145],[207,102],[46,12],[404,197],[1845,858],[106,73],[-43,90],[168,142],[49,-90],[24,10],[6,-15],[72,33],[-4,10],[44,23],[12,-22],[49,20],[6,-13],[48,48],[143,112],[69,78],[39,6],[30,-24],[90,61],[-51,70],[175,104],[46,-82],[209,111],[8,6],[54,-74],[7,-30],[19,-17],[31,-35],[16,-21],[46,-66],[3,2],[12,6],[60,31],[22,7],[53,9],[79,7],[4,-1],[4,-2],[101,51],[77,37],[305,149],[42,27],[143,67],[11,5],[5,2],[39,20],[23,-45],[197,91],[5,2],[49,28],[25,14],[12,7],[35,19],[18,10],[30,10],[15,5],[25,11],[19,10],[7,3],[29,17],[17,13],[12,7],[151,68],[10,7],[5,3],[13,9],[4,-5],[5,2],[8,4],[16,7],[8,-1],[18,31]]],"transform":{"scale":[0.000008207837383235909,0.000005875898723391629],"translate":[2.102620560485179,41.318050722002404]}}

0 commit comments

Comments
 (0)