Because I was not entirely satisfied with the built-in SVG export option of ArcMap I wrote this short macro to do it my own way. The essential feature, compared to ArcMap’s built-in SVG export, is that I can define an (known) ID for every SVG element out of the attribute table. Thus I’m able to access my SVG elements later via JavaScript.
What the macro does:
- Exports all layers and features of your map document (mxd) to SVG
- Every layer will be preserved as SVG group
- Adds the values of the field “SVG_ID” of your attribute table to every SVG element as ID
- Units and extent are taken from the layer properties of ArcMap
- Produces clean SVG 1.1 code
What the macro does not:
- no formating – no colours, stroke-widths, etc. – everything will be visible as black in black (I just needed a clean SVG skeleton, graphic attributes I add later via interactivity)
- no HTML embedding, you get just the SVG code
If you think this can be useful for your purpose, just copy & paste the code of the text file into the Visual Basic Editor of ArcMap (Project/ArcMap Objects/ThisDocument) and hit run.