问题
D3 allows to convert geojson/topojson arrays of points' coordinates
[ [x,y],[x,y],[x,y],...] // aka, a geojson arc.
And, via a projection, into svg paths
<path d="M x,y x,y x,y ..."></path> // aka, an svg-xml path
Note: the values actually change. Points [x,y] in topojson, get new valued via projection([x,y])
for svg's path.
So, if we store in the svg:
the projection name
the points absolute coordonates relative to the svg origine 0,0 (already stored in the path).
Use
projection.invert()
We could convert from xml back into topojson/shp, including hand added shapes.
I am unaware so far of any open source tool doing so.
Question become: What minimal requirements should i store in my svg so it keep the potential to be converted back into gis formats ? (i may have missed some points)
Edit: While aware about it, the complexity of handling Point
, LineString
, Polygon
, MultiPoints
, MultiLineStrings
, MultiPolygons
is not the issue right now. Just the minimal requirements so backward conversion stays possible.
Edit2: convert back to geojson would likely be easier, since the svg and geojson data structures are more similar.
来源:https://stackoverflow.com/questions/28266721/how-to-convert-from-d3-svg-to-topojson-geojson