1

我正在尝试为比利时的一个城市生成一个 TopoJSON,称为 Gent。他们给了我们一个 shapefile(在这里找到https://www.dropbox.com/s/21qv9eqez0qe0va/Gent-shapefile.zip?dl=0)。

然而,生成 TopoJSON 对我来说是一个挑战。

我尝试使用mapshaper:

{
"type": "Topology",
"objects": {
    "deelgebieden_3": {
        "type": "GeometryCollection",
        "bbox": [94655.09380000085, 185681.89059999958, 113641.54690000085, 208831.7499999996],
        "geometries": [{
            "type": "Polygon",
            "arcs": [
                [0, 1]
            ]
        }, {
            "type": "Polygon",
            "arcs": [
                [2, 3, 4, 5, -2, 6]
            ]
        }, {
            "type": "MultiPolygon",
            "arcs": [
                [
                    [-4, 7]
                ],
                [
                    [-7, -1, -6, 8]
                ]
            ]
        }]
    }
},
"arcs": [
    [
        [5215, 2557],
        [-189, 57],
        [-252, 78],
        [-5, -8],
        [-50, 16],
        [-564, 173],
        [-47, 13],
        [24, 46],
        [26, 28],
        [96, 57],
        [57, 48],
        [5, 25],
        [-12, 15],
        [-74, 4],
        [-43, 13],
        [-1, 16],
        [46, 61],
        [21, 22],
        [11, 47],
        [22, 43],
        [78, 96]
    ],
    [
        [4364, 3407],
        [29, 42],
        [-32, 57],
        [3, 31],
        [30, 24],
        [22, -20],
        [25, -1],
        [21, 3],
        [306, 163],
        [5, -14],
        [32, 19],
        [18, -11],
        [20, 24],
        [14, 70],
        [61, 48],
        [50, 37],
        [42, -14],
        [136, -35],
        [45, -57],
        [39, 14],
        [14, 26],
        [116, 56],
        [48, -21],
        [6, 16],
        [39, 40],
        [24, -2],
        [18, -17],
        [52, -24],
        [48, -28],
        [17, -23],
        [24, -60],
        [20, -27],
        [31, -44],
        [28, -72],
        [14, -58],
        [31, -123],
        [79, -130],
        [9, -31],
        [-9, -97],
        [5, -39],
        [44, -87],
        [26, -16],
        [35, -5],
        [-55, -70],
        [-16, -40],
        [-24, -65],
        [-22, -20],
        [7, -25],
        [-18, 5],
        [-19, -3],
        [-23, -3],
        [-59, -12],
        [-40, -29],
        [-13, -37],
        [0, -48],
        [5, -23],
        [22, -49],
        [23, -76],
        [-78, -26],
        [-75, -10],
        [-83, 3],
        [-68, 15],
        [-5, -8],
        [-193, 57]
    ],
    [
        [6510, 3461],
        [82, -8],
        [183, -19],
        [55, -5],
        [47, 9],
        [47, 14],
        [37, -80]
    ],
    [
        [6961, 3372],
        [-75, -19],
        [-81, -27],
        [31, -40],
        [5, -28],
        [-7, -24],
        [-19, -19],
        [-178, -97],
        [116, -91],
        [-85, -39],
        [-13, 14],
        [-90, -46],
        [0, -39],
        [73, -4],
        [14, -34],
        [93, 26],
        [13, -37],
        [8, -43],
        [4, -68],
        [-180, -60],
        [-3, -29],
        [-11, -29],
        [-20, -32],
        [-24, -33],
        [-128, -166],
        [-14, -24],
        [-14, -33],
        [-8, -43],
        [-2, -51],
        [-144, 105],
        [-55, -18],
        [33, -51]
    ],
    [
        [6200, 2293],
        [-82, -22],
        [16, -76],
        [3, -58],
        [-35, -116],
        [-25, -92],
        [-18, -51],
        [-39, -67],
        [-12, -40],
        [4, -60],
        [-8, -29],
        [-45, -62],
        [22, -34],
        [78, 22],
        [48, 5],
        [48, -14],
        [27, -25],
        [-1, -28],
        [-115, -118]
    ],
    [
        [6066, 1428],
        [-46, 17],
        [-65, 40],
        [-111, 48],
        [-181, 67],
        [-76, 20],
        [-97, 14],
        [-212, 7],
        [-90, 5],
        [-108, 11],
        [-107, 23],
        [-97, 43],
        [-74, 44],
        [-72, 60],
        [-57, 64],
        [45, -5],
        [19, -15],
        [32, 1],
        [-2, 43],
        [14, 4],
        [-4, 112],
        [387, 210],
        [23, 10],
        [-68, 74],
        [19, 7],
        [15, 45],
        [40, 79],
        [11, 41],
        [11, 60]
    ],
    [
        [4364, 3407],
        [-32, 8],
        [-58, -16],
        [-24, 4],
        [-27, 16],
        [-21, 36],
        [-20, 55],
        [2, 33],
        [11, 41],
        [-11, 49],
        [-57, 25],
        [-20, 21],
        [2, 28],
        [-9, 18],
        [-72, 52],
        [-21, 1],
        [-29, -13],
        [-18, 30],
        [-37, 35],
        [-43, 33],
        [-16, 29],
        [-4, 31],
        [11, 21],
        [69, 50],
        [-27, 51],
        [26, 45],
        [28, 37],
        [63, 63],
        [82, 78],
        [99, 83],
        [-8, 7],
        [101, 72],
        [129, 82],
        [101, 61],
        [69, 43],
        [107, 53],
        [26, -44],
        [88, 8],
        [30, 15],
        [56, 15],
        [94, 14],
        [19, -6],
        [49, 7],
        [13, -43],
        [21, -35],
        [28, -36],
        [36, -29],
        [43, -22],
        [56, -15],
        [46, 1],
        [28, -11],
        [-62, -3],
        [-63, -11],
        [-53, -25],
        [-42, -37],
        [-28, -39],
        [-19, -48],
        [-3, -49],
        [9, -44],
        [11, -42],
        [226, 44],
        [65, 12],
        [89, 5],
        [15, 6],
        [38, 91],
        [-24, 14],
        [-21, 22],
        [-11, 32],
        [-26, 385],
        [-20, 260],
        [7, 64],
        [20, 49],
        [50, 91],
        [160, -55],
        [7, -54],
        [-99, 7],
        [34, -154],
        [20, -158],
        [9, -56],
        [79, 4],
        [24, -208],
        [-12, -85],
        [34, 0],
        [8, 18],
        [181, 17],
        [93, 18],
        [77, 28],
        [47, 29],
        [5, -10],
        [7, -21],
        [-34, -33],
        [-23, -38],
        [-6, -39],
        [17, -52],
        [26, -61],
        [33, -45],
        [14, -35],
        [8, -42],
        [-62, -46],
        [9, -74],
        [-5, -16],
        [-7, -7],
        [-102, -107],
        [0, -21],
        [42, -162],
        [32, -45],
        [156, 48],
        [219, -294],
        [0, -13],
        [-21, -39],
        [39, -3]
    ],
    [
        [6961, 3372],
        [45, 3],
        [94, 2],
        [93, -5],
        [99, -11],
        [82, -16],
        [90, -22],
        [77, -25],
        [77, -26],
        [64, -28],
        [58, -35],
        [47, -44],
        [46, -51],
        [33, -56],
        [22, -65],
        [9, -61],
        [-4, -56],
        [-15, -61],
        [-36, -62],
        [-58, -70],
        [-27, -43],
        [-14, -42],
        [-8, -73],
        [-8, -79],
        [-85, -1],
        [-4, -38],
        [-51, -11],
        [-124, -16],
        [-33, 38],
        [-67, -17],
        [-40, -11],
        [-30, -17],
        [-181, -99],
        [43, -22],
        [-76, -43],
        [-96, -17],
        [-56, 10],
        [-10, -23],
        [1, -31],
        [11, -45],
        [-15, -29],
        [8, -44],
        [15, -28],
        [29, -27],
        [-15, -26],
        [-41, 11],
        [-9, -14],
        [31, -19],
        [-21, -20],
        [-13, 17],
        [-23, -18],
        [-32, -24],
        [-26, 16],
        [-53, -30],
        [-59, 0],
        [-130, 151],
        [-109, 110],
        [-84, -87],
        [-24, 49],
        [0, 14],
        [-50, 42],
        [-21, 7],
        [-37, 38],
        [-50, 101]
    ],
    [
        [6066, 1428],
        [186, -75],
        [-61, -10],
        [-35, -17],
        [-24, -28],
        [-9, -39],
        [5, -44],
        [9, -41],
        [-6, -43],
        [-23, -35],
        [-34, -33],
        [-35, -16],
        [-40, -5],
        [-66, 6],
        [-82, 12],
        [-59, 11],
        [-70, 27],
        [-63, 23],
        [-40, 8],
        [-46, -2],
        [-41, -9],
        [-39, -12],
        [-45, -23],
        [-47, -29],
        [-47, -48],
        [-33, -54],
        [-19, -63],
        [2, -67],
        [26, -116],
        [2, -74],
        [-12, -38],
        [-25, -30],
        [-65, -65],
        [-34, -42],
        [-100, -144],
        [-103, -136],
        [-87, -95],
        [-85, -82],
        [-29, 34],
        [9, 48],
        [-16, 17],
        [-33, 4],
        [-29, -10],
        [-16, -14],
        [-8, -17],
        [-43, 52],
        [-26, -17],
        [-17, 25],
        [-29, 23],
        [-36, 13],
        [-21, -13],
        [-20, 17],
        [78, 80],
        [18, 36],
        [2, 40],
        [-13, 48],
        [-68, 42],
        [-42, 23],
        [-40, 46],
        [-15, 41],
        [-12, 32],
        [-202, 204],
        [-57, -6],
        [-87, 31],
        [-69, 25],
        [-89, 27],
        [-42, 19],
        [-85, 34],
        [-54, 12],
        [-49, 67],
        [-55, 81],
        [-102, 131],
        [-7, 66],
        [-12, 40],
        [-23, 28],
        [-149, 106],
        [-65, 39],
        [-43, 46],
        [-79, 61],
        [-47, 106],
        [-42, 19],
        [-92, -167],
        [-99, -121],
        [-84, -18],
        [-90, -54],
        [-112, 276],
        [19, 46],
        [6, 51],
        [2, 30],
        [16, 28],
        [74, 55],
        [84, 81],
        [-38, 31],
        [-17, -16],
        [-40, 5],
        [-51, 79],
        [-102, 105],
        [-136, 116],
        [-14, -30],
        [5, -25],
        [1, -32],
        [-19, -28],
        [-44, -23],
        [-65, -18],
        [-45, 18],
        [8, 21],
        [5, 34],
        [-18, 59],
        [-36, 43],
        [-58, 63],
        [-31, 28],
        [-17, 26],
        [-10, 33],
        [-24, 26],
        [-58, 43],
        [-42, 15],
        [-18, -3],
        [-37, -24],
        [-23, 2],
        [-80, 55],
        [-18, 24],
        [-2, 19],
        [-12, 18],
        [-29, 14],
        [-77, 29],
        [-100, 25],
        [-34, 12],
        [-12, 17],
        [4, 28],
        [-15, 19],
        [-21, 8],
        [-42, 1],
        [-72, -10],
        [-56, -16],
        [-41, -19],
        [-99, -56],
        [-71, -48],
        [-42, -49],
        [-33, -44],
        [-26, -46],
        [-10, -31],
        [7, -33],
        [-95, 21],
        [-18, -64],
        [-21, -88],
        [-44, -67],
        [-105, -86],
        [-58, 39],
        [-38, 26],
        [-34, 18],
        [-35, 42],
        [-42, 0],
        [-31, 12],
        [-29, 22],
        [-27, -21],
        [-57, 41],
        [-47, 17],
        [-45, 40],
        [13, 14],
        [-263, 138],
        [260, 422],
        [187, 93],
        [-5, 70],
        [-12, 43],
        [-36, 60],
        [64, 63],
        [38, -12],
        [94, 93],
        [-4, 31],
        [35, 43],
        [56, 34],
        [40, -13],
        [42, -3],
        [29, -30],
        [44, -26],
        [42, 49],
        [30, 37],
        [39, 40],
        [10, 33],
        [48, 85],
        [10, 5],
        [42, 43],
        [22, 3],
        [22, 29],
        [24, -12],
        [27, 34],
        [-103, 52],
        [40, 38],
        [26, 35],
        [53, -27],
        [71, 149],
        [-24, 37],
        [3, 65],
        [-11, 50],
        [-36, 13],
        [-41, 24],
        [-34, 26],
        [-12, 0],
        [-81, 51],
        [-40, -31],
        [-11, 11],
        [-27, -4],
        [6, -16],
        [-26, -30],
        [-27, 14],
        [-52, 26],
        [4, 18],
        [25, 5],
        [4, 57],
        [8, 26],
        [76, 57],
        [22, -11],
        [27, 13],
        [-9, 13],
        [32, 14],
        [3, 10],
        [-12, 13],
        [30, 63],
        [37, 34],
        [19, 31],
        [27, 15],
        [46, 50],
        [46, 32],
        [60, 102],
        [44, 5],
        [16, 15],
        [56, -1],
        [12, 9],
        [25, 3],
        [36, 32],
        [116, -109],
        [11, -36],
        [17, -25],
        [32, -23],
        [44, 23],
        [122, 135],
        [-42, 31],
        [85, 71],
        [47, 93],
        [113, 59],
        [78, 49],
        [43, 15],
        [48, -1],
        [112, -46],
        [-15, -46],
        [19, -168],
        [69, 9],
        [35, 10],
        [125, -13],
        [20, 9],
        [30, 23],
        [77, 37],
        [35, 6],
        [16, 26],
        [90, 77],
        [130, -157],
        [39, -52],
        [9, 5],
        [90, 69],
        [36, 51],
        [91, 54],
        [35, 36],
        [34, 23],
        [-201, 131],
        [-182, 113],
        [52, 14],
        [49, 2],
        [78, -31],
        [55, 12],
        [23, -10],
        [94, 29],
        [683, 195],
        [190, 71],
        [165, 83],
        [172, 104],
        [199, 129],
        [169, 108],
        [80, 37],
        [85, 30],
        [85, 16],
        [74, 1],
        [112, -14],
        [173, 184],
        [80, 26],
        [30, 23],
        [27, 12],
        [24, -5],
        [14, 11],
        [34, -5],
        [54, 40],
        [20, -3],
        [16, 8],
        ...
    ],
    [
        [4558, 2016],
        [-60, -19],
        [12, -67],
        [2, -51],
        [-57, -228],
        [-29, -58],
        [-9, -36],
        [3, -53],
        [-6, -25],
        [-33, -54],
        [16, -30],
        [57, 19],
        [36, 5],
        [35, -13],
        [20, -22],
        [-1, -25],
        [-84, -103]
    ],
    [
        [4460, 1256],
        [-35, 14],
        [-47, 36],
        [-81, 42],
        [-134, 59],
        [-56, 18],
        [-71, 12],
        [-156, 6],
        [-146, 14],
        [-78, 21],
        [-72, 37],
        [-54, 39],
        [-53, 52],
        [-41, 57],
        [70, -17],
        [9, 41],
        [-3, 99],
        [285, 184],
        [16, 9],
        [-49, 65],
        [13, 7],
        [11, 39],
        [30, 69],
        [16, 89]
    ],
    [
        [3209, 2996],
        [-24, 7],
        [-43, -15],
        [-37, 18],
        [-31, 80],
        [10, 65],
        [-8, 43],
        [-42, 22],
        [-14, 19],
        [-6, 40],
        [-52, 46],
        [-38, -10],
        [-13, 26],
        [-58, 60],
        [-15, 52],
        [7, 19],
        [52, 44],
        [-20, 44],
        [39, 73],
        [107, 124],
        [73, 73],
        [-6, 6],
        [74, 64],
        [95, 72],
        [125, 90],
        [79, 47],
        [19, -38],
        [65, 6],
        [63, 27],
        [69, 12],
        [50, 2],
        [10, -38],
        [35, -62],
        [58, -46],
        [42, -13],
        [-77, -43],
        [-31, -32],
        [-20, -35],
        [-14, -42],
        [-2, -43],
        [15, -76],
        [213, 50],
        [76, 9],
        [28, 80],
        [-33, 32],
        [-7, 28],
        [-20, 338],
        [-14, 229],
        [5, 57],
        [14, 42],
        [37, 80],
        [117, -48],
        [6, -47],
        [-73, 6],
        [25, -135],
        [21, -189],
        [58, 4],
        [18, -183],
        [-9, -75],
        [31, 16],
        [134, 15],
        [68, 16],
        [56, 24],
        [35, 25],
        [9, -27],
        [-25, -29],
        [-17, -33],
        [-4, -35],
        [31, -99],
        [24, -39],
        [17, -68],
        [-46, -40],
        [7, -65],
        [-4, -15],
        [-81, -100],
        [1, -18],
        [30, -143],
        [24, -39],
        [115, 42],
        [161, -258],
        [-15, -46],
        [28, -3]
    ],
    [
        [5117, 2965],
        [103, 4],
        [141, -14],
        [126, -33],
        [113, -45],
        [48, -24],
        [42, -31],
        [69, -84],
        [24, -49],
        [16, -58],
        [6, -53],
        [-2, -49],
        [-11, -53],
        [-27, -56],
        [-42, -61],
        [-20, -38],
        [-10, -37],
        [-12, -133],
        [-63, -1],
        [-3, -33],
        [-128, -24],
        [-25, 33],
        [-79, -24],
        [-154, -102],
        [31, -20],
        [-56, -38],
        [-70, -15],
        [-42, 9],
        [-7, -20],
        [9, -67],
        [-11, -26],
        [6, -38],
        [32, -48],
        [-11, -23],
        [-30, 9],
        [-9, -31],
        [-40, -37],
        [-19, 14],
        [-39, -26],
        [-44, 0],
        [-95, 132],
        [-80, 97],
        [-62, -76],
        [-18, 55],
        [-52, 43],
        [-27, 33],
        [-37, 89]
    ],
    [
        [4460, 1256],
        [136, -66],
        [-45, -9],
        [-25, -15],
        [-18, -25],
        [-6, -34],
        [10, -75],
        [-5, -37],
        [-41, -60],
        [-56, -19],
        [-48, 5],
        [-104, 21],
        [-97, 44],
        [-64, 5],
        [-59, -19],
        [-67, -45],
        [-35, -42],
        [-24, -47],
        [-14, -56],
        [2, -60],
        [18, -102],
        [2, -64],
        [-9, -33],
        [-91, -121],
        [-74, -127],
        [-75, -119],
        [-64, -83],
        [-62, -73],
        [-22, 30],
        [6, 42],
        [-11, 15],
        [-46, -5],
        [-17, -28],
        [-32, 46],
        [-19, -14],
        [-34, 41],
        [-57, 16],
        [57, 70],
        [14, 32],
        [2, 34],
        [-10, 43],
        [-81, 57],
        [-29, 40],
        [-20, 64],
        [-149, 180],
        [-41, -6],
        [-115, 50],
        [-66, 24],
        [-93, 46],
        [-40, 11],
        [-76, 130],
        [-75, 115],
        [-5, 58],
        [-9, 35],
        [-17, 25],
        [-110, 93],
        [-47, 35],
        [-32, 40],
        [-58, 54],
        [-35, 93],
        [-31, 17],
        [-67, -148],
        [-73, -105],
        [-62, -16],
        [-66, -48],
        [-82, 243],
        [14, 40],
        [6, 71],
        [11, 25],
        [55, 48],
        [61, 72],
        [-28, 27],
        [-12, -15],
        [-30, 5],
        [-37, 70],
        [-75, 92],
        [-100, 102],
        [-10, -26],
        [4, -51],
        [-13, -25],
        [-33, -20],
        [-48, -15],
        [-33, 16],
        [10, 48],
        [-13, 52],
        [-70, 93],
        [-22, 24],
        [-20, 53],
        [-61, 60],
        [-31, 13],
        [-40, -24],
        [-17, 3],
        [-59, 48],
        [-23, 53],
        [-78, 38],
        [-98, 33],
        [-7, 39],
        [-26, 24],
        [-84, -8],
        [-41, -14],
        [-103, -66],
        [-52, -42],
        [-55, -82],
        [-27, -67],
        [5, -30],
        [-70, 19],
        [-28, -134],
        [-32, -58],
        [-77, -76],
        [-96, 73],
        [-26, 36],
        [-31, 1],
        [-44, 30],
        [-19, -19],
        [-43, 36],
        [-34, 15],
        [-33, 35],
        [9, 13],
        [-193, 120],
        [191, 372],
        [138, 81],
        [-4, 62],
        [-9, 38],
        [-26, 52],
        [47, 56],
        [28, -11],
        [69, 82],
        [-3, 27],
        [26, 38],
        [40, 31],
        [61, -14],
        [22, -27],
        [32, -23],
        [82, 111],
        [7, 29],
        [35, 75],
        [70, 70],
        [18, -11],
        [20, 31],
        [-75, 45],
        [48, 64],
        [38, -23],
        [53, 131],
        [-18, 32],
        [2, 57],
        [-7, 44],
        [-27, 11],
        [-55, 44],
        [-9, 0],
        [-60, 45],
        [-37, -17],
        [-34, -44],
        [-59, 35],
        [22, 20],
        [8, 73],
        [57, 51],
        [52, 24],
        [-7, 21],
        [23, 55],
        [27, 30],
        [14, 28],
        [19, 13],
        [35, 43],
        [33, 29],
        [45, 89],
        [32, 5],
        [11, 13],
        [42, 0],
        [27, 10],
        [26, 28],
        [86, -96],
        [20, -53],
        [24, -21],
        [33, 20],
        [89, 119],
        [-31, 28],
        [62, 62],
        [35, 81],
        [83, 53],
        [57, 43],
        [32, 12],
        [35, 0],
        [82, -41],
        [-10, -40],
        [13, -147],
        ...
    ]
],
"objects": {
    "deelgebieden_3": {
        "type": "GeometryCollection",
        "geometries": [{
            "arcs": [
                [0, 1]
            ],
            "type": "Polygon",
            "properties": {
                "OBJECTID": 1,
                "name": "kernstad",
                "Shape_Leng": 11873.1692712,
                "Shape_Area": 7422070.05338
            }
        }, {
            "arcs": [
                [2, 3, 4, 5, -2, 6]
            ],
            "type": "Polygon",
            "properties": {
                "OBJECTID": 2,
                "name": "19de eeuwse gordel",
                "Shape_Leng": 38380.8073953,
                "Shape_Area": 17401398.2273
            }
        }, {
            "arcs": [
                [
                    [-4, 7]
                ],
                [
                    [-7, -1, -6, 8]
                ]
            ],
            "type": "MultiPolygon",
            "properties": {
                "OBJECTID": 3,
                "name": "periferie",
                "Shape_Leng": 125134.256122,
                "Shape_Area": 133136176.346
            }
        }]
    }
}

}

看起来不错,但不工作。使用命令行进行转换更糟糕:名称被删除,...

我使用 d3 Datamaps,并在其上使用墨卡托投影:

const projection = d3.geo.mercator()
                .center([4.294531, 50.864921])
                .scale(scale)
                .translate([el.offsetWidth / 2, el.offsetHeight / 2]);

            const path = d3.geo.path().projection(projection);

            return {
                path: path,
                projection: projection
            };

可悲的是,这导致: 结果

想法?

4

0 回答 0