topojson/world-atlas

Keep properties frequently used as ID for datasets.

Closed this issue · 1 comments

By default, keep -p name=ADMIN,iso2=WB_A2,iso3=WB_A3 since in many cases, the csv we plug onto the topojson use these previous values as ID, it would ease hooking the topojson and the data.

On Topojson@1.0, should be something like :

# download NaturalEarthData
curl \
    -L -C - 'https://github.com/nvkelso/natural-earth-vector/archive/v4.0.0.zip' \
    -o ./ne.shp.zip
unzip -n ./ne.shp.zip -d ./
# Install topojson v.1 locally
npm install topojson@1.0
# Run topojson
node ./node_modules/topojson/bin/topojson -q 1e3 --bbox \
     -p name=ADMIN,iso2=WB_A2,iso3=WB_A3 \
     -o world-all.json \
     -- countries=./natural-earth-vector-4.0.0/10m_cultural/ne_10m_admin_0_countries.shp

Note: NE v4.0 data is :

{
  "properties": {
    "scalerank": 0,
    "featurecla": "Admin-0 country",
    "LABELRANK": 2,
    "SOVEREIGNT": "France",
    "SOV_A3": "FR1",
    "ADM0_DIF": 1,
    "LEVEL": 2,
    "TYPE": "Country",
    "ADMIN": "France",
    "ADM0_A3": "FRA",
    "GEOU_DIF": 0,
    "GEOUNIT": "France",
    "GU_A3": "FRA",
    "SU_DIF": 0,
    "SUBUNIT": "France",
    "SU_A3": "FRA",
    "BRK_DIFF": 0,
    "NAME": "France",
    "NAME_LONG": "France",
    "BRK_A3": "FRA",
    "BRK_NAME": "France",
    "BRK_GROUP": null,
    "ABBREV": "Fr.",
    "POSTAL": "F",
    "FORMAL_EN": "French Republic",
    "FORMAL_FR": null,
    "NAME_CIAWF": "France",
    "NOTE_ADM0": null,
    "NOTE_BRK": null,
    "NAME_SORT": "France",
    "NAME_ALT": null,
    "MAPCOLOR7": 7,
    "MAPCOLOR8": 5,
    "MAPCOLOR9": 9,
    "MAPCOLOR13": 11,
    "POP_EST": 67106161,
    "POP_RANK": 16,
    "GDP_MD_EST": 2699000,
    "POP_YEAR": 2017,
    "LASTCENSUS": -99,
    "GDP_YEAR": 2016,
    "ECONOMY": "1. Developed region: G7",
    "INCOME_GRP": "1. High income: OECD",
    "WIKIPEDIA": -99,
    "FIPS_10_": "FR",
    "ISO_A2": "-99",
    "ISO_A3": "-99",
    "ISO_A3_EH": "-99",
    "ISO_N3": "250",
    "UN_A3": "250",
    "WB_A2": "FR",
    "WB_A3": "FRA",
    "WOE_ID": -90,
    "WOE_ID_EH": 23424819,
    "WOE_NOTE": "Includes only Metropolitan France (including Corsica)",
    "ADM0_A3_IS": "FRA",
    "ADM0_A3_US": "FRA",
    "ADM0_A3_UN": -99,
    "ADM0_A3_WB": -99,
    "CONTINENT": "Europe",
    "REGION_UN": "Europe",
    "SUBREGION": "Western Europe",
    "REGION_WB": "Europe & Central Asia",
    "NAME_LEN": 6,
    "LONG_LEN": 6,
    "ABBREV_LEN": 3,
    "TINY": -99,
    "HOMEPART": 1,
    "MIN_ZOOM": 0,
    "MIN_LABEL": 1.7,
    "MAX_LABEL": 6.7
  }
}

For convenience for later data biding, topojson files would gain to have at least iso2 as hook :

{
  "type": "MultiPolygon",
  "arcs": [
    [ [4347,4348,4349] ],
    [ [4350,4350,4351,4352,4353,4354] ],
    [ [4355,4356,4357,4358,4358,4358,4359,4360,4361,-4350,4362,4363,-3047,-1961,-1960,-598], [4364], [4365] ]
  ],
  "properties": {
    "name": "Italy",
    "iso2": "IT",
    "iso3": "ITA"
  }
},

See also How to create optimal world topojson from free world shp : Aborted (core dumped)?
and its world-id.json that you can visualize in the distillery and explore in http://jsoneditoronline.org.

I’ve added name=NAME for version 2.0.0. I’m hesitant to add the ISO_A2 and ISO_A3 country codes since we already have the ISO_N3 codes as unique identifiers, and in many cases the alpha codes are "-99".

Are there some example datasets you can share that are keyed by alpha code that would demonstrate the utility of including these alpha codes by default? If so I’d be happy to reconsider and reopen this issue. Apologies for the delayed reply.