5

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. Topojson points [x,y], are transformed via projection([x,y]) into new values for the svg's path.

So, if we store in the svg:

  1. the projection name

  2. the points absolute coordinates relative to the svg origine 0,0 (already stored in the path).

  3. Use projection.invert()

We could convert from xml svg back into topojson/shp, including the hand added shapes and layers.

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.

Hugolpz
  • 17,296
  • 26
  • 100
  • 187
  • @StephenThomas: I know, i just start the talk about "what would be need so such functions could work". – Hugolpz Feb 01 '15 at 19:24

0 Answers0