0

A client has supplied a "custom" SVG containing a very detailed world map that includes id's for all countries. I'm not sure how "custom" it is.

svg

Is it at all possible to convert it to topojson, which is needed to use it with react-simple-maps?

https://www.react-simple-maps.io

  • Depends a lot on the SVG. Are the vectors coded in lat-long in the SVG? Do you need a true lat-long topojson (for example to line up with other spatial layers)? SVG is XML so in principle you can parse it and turn it into any other format but that would require programming skill and some decoding of SVG parameters. Possible but is it worth it? Or try loading it into QGIS (unlikely, its probably not recognised) or Inkscape or other SVG editor? – Spacedman Apr 26 at 15:51
  • Thanks for your comment. It contains polygons as well as paths. The data inside the elements "d" attribute doesn't look like lon/lat to me. Will try loading it into qgis now. – riccardolardi Apr 26 at 16:03
  • Hmm its possibly scaled to A4 paper or something. This question has been asked before and you should probably check out answers here gis.stackexchange.com/questions/11476/importing-svg-into-gis and also I just found an online converter: mygeodata.cloud/converter/svg-to-shp which might get you something that needs stretching to match lat-long. – Spacedman Apr 26 at 16:08
  • When I try to convert the svg using the tool you mentioned mygeodata.cloud I get an error saying "No spatial data were recognized in your uploaded data. We are sorry. Make sure you have uploaded all relevant files of the dataset." – riccardolardi Apr 26 at 16:18
  • I think it needs either a custom solution or you go back to the supplier and say "ummmm no thanks".... – Spacedman Apr 26 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.