Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

element id not written correctly #9

Open
bockoblur opened this issue Oct 12, 2019 · 2 comments
Open

element id not written correctly #9

bockoblur opened this issue Oct 12, 2019 · 2 comments

Comments

@bockoblur
Copy link

bockoblur commented Oct 12, 2019

Hi. I have svg file with path ids (like id="some_string")

and running your tool with -d option gives me the following output:

{ 
 {"type":"Feature",
  "properties":{
   "svgID":"#[object Object]"   /* <--- note object id! */
},
  "geometry":{
      _etc, the rest is ok_
 ]
 }`

Note that path ids are #[object Object] instead of string ids.
Bug? Or am I doing something wrong?

@bockoblur
Copy link
Author

On closer inspection of source code, I found what the error is:

Line 273 of svg2geojson.js

should read:

geo.coordinates.debugId = (el.$ && el.$.id) ? `${el.$.id.value}` : fallback;

instead of

geo.coordinates.debugId = (el.$ && el.$.id) ? `#${el.$.id}` : fallback;

Note the added .value property of id object, which is the actual string containing the svg elements' id attribute.

@roxanalascu
Copy link
Contributor

roxanalascu commented Aug 5, 2021

Hi @Phrogz,
Thank you for this nice lib!
Do you think this issue could be solved any time soon? It seems to be a very easy fix :)
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants