Add attributes to SVG when rendering from GeoJSON

Hi to all,

I have a question about adding attributes to an SVG file I am rendering from GeoJSON.
We are succesfully iterating through our GeoJSON file like so:

using (var map = new Map(1000, 1000))
 {
      var layer = VectorLayer.Open(AbstractPath.FromStream(stream), Drivers.GeoJson);

      var fill = new SimpleFill { FillColor = Color.Crimson };
      fill.FeatureBasedConfiguration = (feature, symbolizer) => {
          var name = feature.GetValue<string>("name");
      };

      map.Add(layer, fill);
      map.Render(outputPath, Renderers.Svg);
  }

What we would like to do is assign that ‘name’ variable in the feature to each polygon rendered in the SVG. Please note multiple polygons may be rendered for each unique value of ‘name’.

Thanks to anyone able to help.

Hello, @aidengeoJSON! Thank you for your interest in the Aspose.GIS product!

If you wish to have a text label near each polygon, please consider the following example:

        using (var map = new Map(1000, 1000))
        {
            var layer = VectorLayer.Open(AbstractPath.FromStream(stream), Drivers.GeoJson);
            var fill = new SimpleFill { FillColor = Color.Crimson };

            // to render "name" attribute as a label for each multiple polygons.
            var labeling = new SimpleLabeling("name") {MultipartMode = MultipartMode.All};

            map.Add(layer, fill, labeling);
            map.Render(outputPath, Renderers.Svg);
        }

This sample code displays the attribute value for each geometry. It is the simplest way. However, Aspose.GIS provides flexible attributes rendering, more examples can be found here. Thanks.