geojson2svg icon indicating copy to clipboard operation
geojson2svg copied to clipboard

feature properties as attributes

Open kroneman opened this issue 5 years ago • 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"
      />

kroneman avatar Oct 29 '19 22:10 kroneman

+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.

NMC92 avatar Sep 17 '22 15:09 NMC92