Open kk12837 opened 4 years ago
Hey, same question. Is someone maintaining this repo? I don't know how to get X
and Y
values. I only have Lat and Long from Google maps
Alright, I'll leave a comment here explaining a few things as I had a few issues getting this (awesome) little converter to work. If like me you're not quite skilled (or patient) enough to adapt the code to your needs, or append the SVG file with the Geo Metadata, here is how you can do it with relatively simple tools:
First I recommend using INKSCAPE to edit/prepare your SVG file.
Now save your document. This should be an .svg file wherever you saved it. We will now have to edit that and add the geodata.
Then just save the file.
Now go to: https://mygeodata.cloud/converter/svg-to-geojson There upload the file. If you've done the above right. It should work. If it says it cannot find any spatial data, then the pasting of the geodata in the svg file didn't go right. Because in the code the parser that is looking for the data is very finnicky so if the geodata (metainfo) wasn't added in the exact way (might be missing a tab or space or an enter or newline) the it won't work. I took my quite a few tries and its why I do this in the online XML editor I linked above as it seems to maintain correct format. I litteraly paste in the file text, go to <defs, press enter just in front of it, and then paste in the MetaInfo Geodata above.
Now for the last part, you need to change the actual data in the geodata. The X and Y should be the pixel coordinates for your bottom right and your top-left corners of the documents respectively. (so one should be X=0 and Y=0 and the other X=width and Y=height of your document, In pixels! (caution in Inkscape this can be mm or inches or other stuff, it should be pixels!)
And then add the corresponding Longitudes and Latitudes ( i just went to Google Maps, checked the most exact points I cold find corresponding and clicked them to get the coordinates, this worked fine).
Enter these number into the metainfo data in your svg file (easiest is through notepad). Save the file. And use it in the converter! TADAA That should be it!
Last comment, keep in mind that if you have complex shapes in your svg they might be converted to geojson but might no actually work in a geojson viewer because, as said in the readme, multipolygons and other complex paths cannot be handled by the converter at the moment. (It will "convert" them but the geojson won't actually work correctly). For simple polygons and lines it works fine =)
Hope this helps someone who has gotten stuck here! Good luck
Hi
Can anyone provide an example of X Y in GeoItem.
I am not sure how to implement it, Attached with a china map.
Thanks
Keith map2.svg.txt