w8r/geojson2svg

feature properties as attributes

kroneman opened this issue · 1 comments

Hey,

First of all great library, took a bit to find but does what I need it to do and works well.

Is it currently possible via configuration or otherwise to take a feature's properties and add them to the path that's created?

GeoJson

{
  "type": "Feature",
  "properties": {
    "country": "indonesia",
    "continent": "asia",
    "canReach": "irkutsk, yakutsk, mongolia, kazakhstan"
  },
  "geometry": {
    "coordinates": [
      ...
    ],
    "type": "Polygon"
  },
  "id": "indonesia"
}

Svg Path

<path
        class="polygon indonesia"
        id="indonesia"
        country="indonesia"
        continent="asia"
        d="M65.143936 69.31215L64.577561 ...."
        stroke="#333"
        stroke-opacity="0.7"
        stroke-width="0.2"
        stroke-linecap="round"
        stroke-linejoin="round"
        fill="#FFAA00"
      />
NMC92 commented

+1. I'd also like this feature to be made available. I need to export the id attribute from the GEOJson feature to the SVG paths and circles that are generated.