z.bali
Posts: 7
Joined: Wed Dec 15, 2021 11:01 am

GeoJson To TopoJson

Hi everyone,
I wonder if there is a solution to convert an edited map (geo Json file) to topology (topoJson)
I tried this tool https://mapshaper.org/ but the exported topolgy doesn't work, GeoJson works fine.
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: GeoJson To TopoJson

Hi z.bali!
We appreciate you reaching out to us!

There is no official tool to convert GeoJSON/TopoJSON files. You can find lots of tools of that kind on the internet, e.g. you can use tools from this package https://github.com/topojson and convert files from GeoJSON to TopoJSON using e.g. https://github.com/topojson/topojson-server

Feel free to ask any further questions!
Best regards!
Hubert Kozik
Highcharts Developer
z.bali
Posts: 7
Joined: Wed Dec 15, 2021 11:01 am

Re: GeoJson To TopoJson

Hello hubert.K,
thanks for the quick reply, I tried 3 solutions online I still get the same error

""""RROR TypeError: Cannot read properties of undefined (reading '0')
at f (map.js:54:192)
at map.js:55:1
at Array.map (<anonymous>)
at f (map.js:54:376)
at d.getGeoMap (map.js:87:17)
at map.js:83:100
at Array.map (<anonymous>)
at new d (map.js:83:81)
at m.<anonymous> (map.js:104:1)
at highcharts.js:18:179
defaultErrorLogger @ core.mjs:6485
"""",
I think the exported format of these solutions is not what you expect in Highmaps
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: GeoJson To TopoJson

z.bali,

This error is meaning that your file has an undefined value in some variables in JSON. It's hard to say what could be done without your GeoJSON and parsed TopoJSON files. I can suggest you see our official TopoJSON files here: https://code.highcharts.com/mapdata and maybe somehow compare them with your parsed file.

Regards!
Hubert Kozik
Highcharts Developer
dswin
Posts: 1
Joined: Wed Jul 12, 2023 2:45 pm

Re: GeoJson To TopoJson

If it's helpful for others, I believe the issue here is that these conversion tools can give you geometry objects that do not have an arcs property. Like this:

{
"type": null,
"id": 51685
},

I'm not sure why. Highcharts expects there to be arcs though, if you filter out the objects with "type: null" it should work

Return to “Highcharts Maps”