Skip to content

Instantly share code, notes, and snippets.

@GitNoise
Last active March 10, 2020 09:15
Show Gist options
  • Save GitNoise/e3d316103c38ce54c2dca5e66953900e to your computer and use it in GitHub Desktop.
Save GitNoise/e3d316103c38ce54c2dca5e66953900e to your computer and use it in GitHub Desktop.
sverige
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="https://d3js.org/topojson.v1.min.js"></script>
<script src="https://d3js.org/d3-geo.v1.min.js"></script>
<script src="https://d3js.org/d3-geo-projection.v2.min.js"></script>
<script src="https://d3js.org/d3-array.v2.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
svg { border: 1px solid red;}
</style>
</head>
<body>
<script>
d3.json('lan.json').then(geoData => {
const size = 400;
const mapData = topojson.feature(geoData, geoData.objects.lan);
const projection = d3.geoMercator();
projection.fitSize(
[size, size],
mapData.features);
const geoPath = d3.geoPath(projection);
const svg = d3.select('body').append('svg')
.attr('width', size)
.attr('height', size);
console.log(mapData.features)
svg.selectAll("path")
.data(mapData.features)
.enter().append("path")
.attr("d", geoPath);
})
</script>
</body>
Display the source blob
Display the rendered blob
Raw
{"type":"Topology","arcs":[[[2193,2422],[38,33],[67,-38],[37,16],[56,-14],[39,34],[-61,52],[-75,98]],[[2294,2603],[-8,41],[66,32],[128,35],[18,48],[83,33],[11,79],[38,98]],[[2630,2969],[59,-15],[44,25],[22,-104],[24,-40],[56,-41],[-41,-58],[16,-50],[-56,6],[-42,-19],[-26,-60],[-53,-30],[-46,-44],[-26,2],[-91,-51],[116,-96],[8,-34],[-39,-46],[-40,0],[-68,-34],[-16,-77],[-37,-63],[-34,64],[-48,-6]],[[2312,2198],[-34,54],[-57,0],[-26,36],[5,56],[-23,62],[16,16]],[[2613,2502],[43,-19],[10,-42],[-55,5],[2,56]],[[2058,2607],[-13,66],[-45,65],[32,49],[-15,68],[-35,25],[15,66],[-5,51]],[[1992,2997],[57,25],[9,28],[69,-11],[36,25],[1,74],[35,26],[18,111]],[[2217,3275],[91,-1],[17,-77],[90,48],[69,-102],[61,-47],[34,-9],[27,43],[49,-45],[-25,-116]],[[2294,2603],[-33,-9],[-18,-45],[-30,2],[-85,51],[-46,-18],[-24,23]],[[1604,2259],[17,67],[32,23]],[[1653,2349],[106,72],[-76,20]],[[1683,2441],[51,47],[94,-2],[-10,44]],[[1818,2530],[133,4],[83,19],[41,-17],[45,-47],[24,52],[48,-11],[15,-31],[-14,-77]],[[2312,2198],[-45,-23],[-37,-75],[-91,-30],[-16,-22],[-66,-24],[-55,6]],[[2002,2030],[-22,29],[-113,19],[-51,86],[-62,57],[-68,35],[-43,-11],[-39,14]],[[1214,1706],[44,171],[94,51],[35,44],[-58,32],[28,67]],[[1357,2071],[32,18],[20,47],[58,44],[33,-18],[65,18],[3,43],[36,36]],[[2002,2030],[-13,-21],[68,-55],[-27,-38],[-38,-12],[-2,-38],[60,-23],[-13,-28],[-59,-11],[49,-47],[-18,-41],[-7,-73]],[[2002,1643],[-49,-10],[-18,68],[-33,-9],[-34,41],[-43,4],[-95,-75],[29,-105],[-52,-32],[-89,32],[-91,-101]],[[1527,1456],[-98,4],[-56,140],[23,40],[-24,73],[-80,-27],[-78,20]],[[1527,1456],[85,-58],[-19,-100],[-36,1],[2,-73],[-14,-43],[23,-36]],[[1568,1147],[-55,20],[-104,-17],[-62,-40],[-6,31],[-38,26],[-83,-22],[-4,-19],[-72,-7],[-4,-89],[22,-25],[-19,-44],[-33,-2],[-40,90],[-41,14],[-112,-7],[-7,-41]],[[910,1015],[-27,51],[-53,25],[-68,-8],[-49,-40],[-16,59],[16,13]],[[713,1115],[23,53],[27,8],[146,194],[20,66],[4,132],[-15,61],[25,42],[65,-25],[39,12],[16,76],[35,-4]],[[1098,1730],[-34,-116],[12,-103],[39,3],[9,65],[59,63],[31,64]],[[1568,1147],[2,-29],[71,-51],[38,-58],[-12,-34],[-106,-14],[11,-57],[-66,-17],[22,-39],[-30,-141]],[[1498,707],[-112,-16],[-50,-60],[-75,23],[-52,35]],[[1209,689],[-96,28],[-43,3],[-42,-24],[-81,-12],[-75,-25],[-43,14]],[[829,673],[6,51],[-53,110],[-10,95],[129,34],[9,52]],[[2002,1643],[6,-51],[-59,-14],[-24,-32],[57,-58],[-40,-106],[39,-59],[-25,-70],[-50,-53],[-6,-54],[13,-41],[29,-13],[-32,-44],[-49,-220],[-26,-6],[-20,-77],[-37,-48],[-24,-90]],[[1754,607],[-72,-2],[-75,92],[-53,28],[-56,-18]],[[1921,879],[31,72],[36,11],[22,68],[42,71],[27,111],[35,38],[24,-29],[-27,-30],[4,-51],[-66,-123],[-19,-97],[-17,-4],[-27,-91],[-4,-47],[-48,-119],[5,-20],[-35,-88],[-27,24],[3,97],[-6,92],[47,115]],[[2619,1539],[37,10],[44,48],[23,-49],[31,54],[50,-12],[34,-35],[-57,-42],[-4,-39],[-45,13],[-22,-141],[47,-77],[-50,-14],[-26,-36],[1,-50],[-97,-61],[-23,-33],[-7,-81],[-63,-22],[25,68],[4,70],[-26,21],[6,97],[-21,119],[55,63],[84,129]],[[1754,607],[-15,-54],[-57,-94],[-56,64],[-47,2],[-87,-34],[-55,16],[-138,-6],[-40,-93],[-42,27]],[[1217,435],[17,24],[-16,86],[-39,4],[-18,68],[48,72]],[[1217,435],[-68,-51],[-52,-83],[3,-83],[21,-14],[31,-79],[-62,-97],[-46,2],[-52,32],[-95,-12],[-111,-50],[-129,40],[-24,105],[49,30],[2,49],[-41,44],[-11,55],[-25,5],[-28,85],[-61,80],[-28,100],[101,-52],[21,28],[-37,58],[-38,19],[32,47],[63,-12]],[[632,681],[15,-48],[73,-10],[109,50]],[[632,681],[18,65],[-17,58],[-60,-1],[-42,86],[1,30],[-95,64],[4,37],[-27,31],[-16,59],[-41,51],[11,71],[-63,14],[-22,50],[8,74]],[[291,1370],[32,-8],[88,34],[21,-22],[0,-61],[24,-36],[6,-86],[36,31],[63,6],[54,-39],[26,-1],[29,-50],[43,-23]],[[291,1370],[1,41],[-70,43],[23,38],[-36,50],[40,99],[0,56],[32,69],[-31,52],[-32,11],[-50,-33],[-62,34],[-34,40],[-2,58],[-20,59],[13,20],[-47,94],[1,54],[-17,46],[0,63],[29,48],[52,13],[34,-57],[-1,-74],[71,13],[20,78],[25,37],[-6,63],[22,17]],[[246,2402],[45,16],[101,7],[13,-44],[55,-3],[15,-32],[39,-6],[23,37],[46,-26],[2,-51]],[[585,2300],[-43,-71],[-5,-47],[-52,-79],[2,-36],[62,-29],[-122,-156],[66,2],[29,42],[105,23],[79,123],[40,-15],[-31,-98],[58,0],[16,60],[95,50],[56,6],[-37,70],[7,21],[100,-1],[20,64],[-7,29],[41,24]],[[1064,2282],[54,-25]],[[1118,2257],[21,-103],[47,-22],[3,-45],[91,-14]],[[1280,2073],[-64,-48],[-4,-51],[-64,-120],[-25,-29],[-25,-95]],[[254,1714],[-96,-28],[-59,51],[140,62],[23,-25],[-8,-60]],[[203,1626],[-35,-28],[-26,62],[51,35],[35,-18],[-25,-51]],[[246,2402],[-45,217],[57,41],[31,44],[-28,75],[38,34],[68,-3],[67,43],[35,44],[33,91],[-15,86],[40,55],[-2,67],[-34,49],[1,30],[-43,58],[-18,91],[-38,78],[90,20],[68,4]],[[551,3526],[9,-31],[169,-149],[10,-42],[83,-106],[21,-49],[70,-18],[55,-92],[104,-15],[27,-90],[80,-45]],[[1179,2889],[-7,-218],[15,-138],[-51,-77],[-14,-102],[18,-37],[-22,-60]],[[1064,2282],[-7,41],[-53,-5],[43,80],[-13,57],[-78,28],[-74,-7],[-36,-53],[-44,65],[-35,-6],[-65,-71],[44,-110],[13,-94],[-55,5],[-11,61],[-63,43],[-45,-16]],[[1599,2456],[-20,-27],[28,-32],[5,-44],[41,-4]],[[1357,2071],[15,28],[-38,37],[-20,-44],[-34,-19]],[[1179,2889],[109,-14],[-10,57],[46,17],[28,-38],[51,5],[92,-86],[27,-42]],[[1522,2788],[70,-141],[5,-66],[35,2],[-1,-65],[-46,3],[14,-65]],[[1522,2788],[46,61],[52,-10],[-5,65],[42,82],[66,10],[73,-44],[8,-32],[66,6],[68,68],[54,3]],[[2058,2607],[-69,-22],[-46,41],[-49,-66],[-76,-30]],[[1683,2441],[-84,15]],[[551,3526],[7,59],[30,20],[29,107],[-100,132],[-52,-4],[-98,97],[50,331]],[[417,4268],[112,-25],[64,5],[130,-125],[48,22],[27,-32],[-57,-47],[73,-66],[71,-96],[131,-23],[134,-13],[51,10]],[[1201,3878],[56,-17],[32,-55],[115,-12],[57,12],[151,-178],[9,-57],[28,-44],[63,-30],[74,-7],[35,-75],[57,-56],[-57,-104],[-33,-9],[45,-57],[46,-80],[42,-11],[71,-101]],[[1262,3384],[22,-29],[62,49],[-58,48],[-37,-4],[11,-64]],[[1201,3878],[9,100],[58,74],[125,-17],[26,48],[-10,28],[117,75],[-31,99]],[[1495,4285],[54,39],[51,3],[157,-66],[161,-1],[101,-21],[39,-20],[205,-22]],[[2263,4197],[-16,-83],[-42,-91],[22,-60],[45,-29],[-13,-52],[-71,43],[-56,-95],[23,-46],[-20,-68],[42,-43],[-38,-59],[9,-89],[22,-34],[-21,-30],[39,-62],[-12,-31],[38,-34],[-45,-35],[48,-24]],[[1495,4285],[-59,-13],[-76,35],[-40,88],[-14,82],[101,2],[184,19],[131,51],[59,-11],[85,5],[11,42],[94,96],[125,14],[-146,142],[-170,120],[4,38],[-55,4],[3,72],[-69,68],[68,-10],[39,25],[55,-20],[129,32],[-9,108],[48,82]],[[1993,5356],[44,-36],[307,-46],[240,71],[38,-98],[148,-29],[99,-120],[35,-79]],[[2904,5019],[-18,-86],[-41,-7],[-5,-51],[-58,-9],[-78,-39],[-39,3],[-38,-57],[14,-56],[-57,-90],[-37,-5],[-82,-97],[5,-39],[-183,-102],[-48,-72],[28,-38],[54,-12],[-58,-65]],[[417,4268],[-89,218],[28,84],[-20,93],[44,57],[-84,168],[84,125],[-23,70],[50,47],[32,57],[105,135],[76,48],[110,29],[188,-29],[91,-22],[71,116],[-13,164],[-165,75],[196,292],[42,42]],[[1140,6037],[165,-109],[26,-49],[59,-31],[6,-36],[65,-23],[47,-83],[64,-38],[57,11],[20,-75],[96,-49],[2,-44],[62,4],[184,-159]],[[1233,4858],[-208,65],[51,-73],[-7,-22],[77,-32],[82,27],[5,35]],[[1140,6037],[15,80],[46,33],[0,88],[15,149],[34,75],[-37,196],[179,9],[159,86],[-6,38]],[[1545,6791],[127,-33],[270,-152],[71,0],[314,-236],[185,-49],[41,-41],[102,-44],[43,-1],[54,-44],[67,-25],[87,-51],[-11,-28],[57,-38],[86,39],[81,111],[311,-111],[192,-27],[7,-24],[67,-31]],[[3696,6006],[-83,-112],[-71,-70],[66,-7],[-1,-101],[71,-34],[13,-51],[29,-20],[-47,-55],[-76,-40],[-95,-83],[-48,-126],[-57,-82],[-53,-5],[-41,-72],[-40,-17],[-97,5],[-106,-92],[-50,1],[-36,-25],[-70,-1]],[[1545,6791],[-28,80],[88,71],[130,172],[134,87],[18,92],[-13,40],[-98,116],[30,54],[78,9],[40,50],[65,178],[174,84],[36,42],[128,-46],[92,-48],[88,138],[-27,132],[8,81],[103,28],[72,-44],[135,10],[332,-87],[118,82],[-104,37],[100,73],[39,78],[-8,68],[-73,73],[171,11],[74,-11],[78,-78],[144,-85],[3,-39],[68,-20],[139,-70],[6,-35],[102,-9],[123,-40],[148,-66],[31,-41],[-7,-46],[48,-8],[42,-67],[88,-49],[-56,-87],[-2,-87],[27,-37],[-51,-84],[132,-41],[-16,-84],[-45,-7],[-13,-63],[38,-74],[53,-54],[65,-91],[-35,-34],[-10,-112],[-84,-71],[16,-40],[-23,-54],[34,-78],[75,-19],[3,-46],[72,-173],[-111,-6],[-29,20],[-116,-29],[-75,25],[-39,-64],[-99,50],[-18,46],[-41,6],[13,-95],[-94,88],[-37,-10],[-16,-84],[11,-100],[-66,-19],[-98,3],[43,-39],[-26,-28],[-98,-4],[-71,-28],[78,-44],[-40,-33],[12,-60],[-27,-41]],[[2593,6386],[-11,43],[-72,13],[-89,84],[16,33],[-55,128],[-130,45],[4,-28],[55,-19],[84,-65],[-73,-22],[135,-145],[33,-79],[103,12]]],"transform":{"scale":[0.0028057224188611234,0.0016218287268178221],"translate":[11.131292974404602,55.34004403738611]},"objects":{"lan":{"type":"GeometryCollection","geometries":[{"arcs":[[[0,1,2,3]],[[4]]],"type":"MultiPolygon","properties":{"LnKod":"01","LnNamn":"Stockholms"}},{"arcs":[[5,6,7,-2,8]],"type":"Polygon","properties":{"LnKod":"03","LnNamn":"Uppsala"}},{"arcs":[[9,10,11,12,-4,13,14]],"type":"Polygon","properties":{"LnKod":"04","LnNamn":"S�dermanlands"}},{"arcs":[[15,16,-15,17,18,19]],"type":"Polygon","properties":{"LnKod":"05","LnNamn":"�sterg�tlands"}},{"arcs":[[20,21,22,23,24,-20]],"type":"Polygon","properties":{"LnKod":"06","LnNamn":"J�nk�pings"}},{"arcs":[[25,26,27,28,-22]],"type":"Polygon","properties":{"LnKod":"07","LnNamn":"Kronobergs"}},{"arcs":[[[-21,-19,29,30,-26]],[[31]]],"type":"MultiPolygon","properties":{"LnKod":"08","LnNamn":"Kalmar"}},{"arcs":[[32]],"type":"Polygon","properties":{"LnKod":"09","LnNamn":"Gotlands"}},{"arcs":[[-27,-31,33,34]],"type":"Polygon","properties":{"LnKod":"10","LnNamn":"Blekinge"}},{"arcs":[[-35,35,36,-28]],"type":"Polygon","properties":{"LnKod":"12","LnNamn":"Sk�ne"}},{"arcs":[[-37,37,38,-23,-29]],"type":"Polygon","properties":{"LnKod":"13","LnNamn":"Hallands"}},{"arcs":[[[39,40,41,42,43,44,-24,-39]],[[45]],[[46]]],"type":"MultiPolygon","properties":{"LnKod":"14","LnNamn":"V�stra G�talands"}},{"arcs":[[-41,47,48,49,-43,50]],"type":"Polygon","properties":{"LnKod":"17","LnNamn":"V�rmlands"}},{"arcs":[[51,-10,-17,52,-44,-50,53,54]],"type":"Polygon","properties":{"LnKod":"18","LnNamn":"�rebro"}},{"arcs":[[55,-6,56,-12,57,-55]],"type":"Polygon","properties":{"LnKod":"19","LnNamn":"V�stmanlands"}},{"arcs":[[58,59,60,-56,-54,-49],[61]],"type":"Polygon","properties":{"LnKod":"20","LnNamn":"Dalarnas"}},{"arcs":[[62,63,64,-7,-61]],"type":"Polygon","properties":{"LnKod":"21","LnNamn":"G�vleborgs"}},{"arcs":[[65,66,67,-64]],"type":"Polygon","properties":{"LnKod":"22","LnNamn":"V�sternorrlands"}},{"arcs":[[-63,-60,68,69,-66],[70]],"type":"Polygon","properties":{"LnKod":"23","LnNamn":"J�mtlands"}},{"arcs":[[-67,-70,71,72,73]],"type":"Polygon","properties":{"LnKod":"24","LnNamn":"V�sterbottens"}},{"arcs":[[74,-73],[75]],"type":"Polygon","properties":{"LnKod":"25","LnNamn":"Norrbottens"}}]}},"crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment