mbloch / mapshaper

Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
http://mapshaper.org
Other
3.74k stars 532 forks source link

export topojson scale with datamaps #654

Open HackerYunen opened 3 weeks ago

HackerYunen commented 3 weeks ago

Hi, I was editing the data of datamaps.world.js (https://github.com/markmarkoh/datamaps/blob/master/dist/datamaps.world.js) which is use topojson data. It was import normally, but when I finish editing work and export it. The data seems like scale larger than before:

first arcs (old one)

    "arcs": [
        [
            [6700, 7164],
            [28, -23],
            [21, 8],
            [6, 27],
            [22, 9],
            [15, 18],
            [6, 47],
            [23, 11],
            [5, 21],
            [13, -15],
            [8, -2]
        ],

after mapshaper edting:

"arcs": [
    [
      [12104, 14632],
      [50, -47],
      [38, 17],
      [11, 55],
      [40, 18],
      [27, 37],
      [11, 96],
      [41, 22],
      [9, 43],
      [24, -31],
      [14, -4]
    ],
mbloch commented 3 weeks ago

Mapshaper applies a default amount of "quantization" to TopoJSON output (that's directly related to the scale of the integer coordinates that you see in the "arcs" array). If you are editing a TopoJSON, you'd probably prefer that mapshaper apply the exact same scaling as the original file. That's not currently an option, although you can use the quantization option of the -o output command to manually set quantization. I'll think about how to better serve your use case -- and welcome your suggestions.