We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.GIS visualize geometry (miniature and full size , image / svg)

I have an application where I use EntityFramework (MSSQL database ) to show the attribute table of data with a geometry column. this geometry column contains (multi) polygons .
I want to show a “miniature” image / svg / png of the polygon / shape in a row or detail view in my application.
I have not been able to do this with Aspose.Gis.

What I was expecting was that I can use Aspose.Gis to instanciate a Aspose.Gis.Feature.Geometry and then just have to say … Feature.ToSVG or Feature.ToPNG to get the image or svg data. base64 data is also ok and usable in a tabular form.

image.png (3.9 KB)

how can I do this with Aspose.Gis
Hope you can guide


We will evaluate your requirements and get back to you soon.


Please notice, we have logged an investigation ticket with an id “GISNET-1326” for your task/issue. We will evaluate and look into the details of your requirements.

Once we have an update on it, we will let you know here.

1 Like

This is actually a very usefull functional addition to generate SVG or PNG of the geometry with a given width and height.

I’m not asking for a timeline , but wanted to bring this issue to your attention again .

Hi, @mcanavar

As a workaround, you need to create a new layer (in memory using some driver) and put the geometry there. Next step, you can draw this layer on a map.

We plan to create an extension to hide this implementation. if you still have questions, let me know

Hi, @mcanavar

The Ticket (GISNET-1326) have been completed in Aspose.GIS for .NET 22.05 . Please feel free to contact us if you have any other issues or difficulty using the product.

1 Like

Hi @Evgeniy.Timofeev,

Thank you for implementing this request.

I have been able to stream and export to file using different renderers with one line. like this:

geometry.AsImage(filenamepath, new Measurement(200, Unit.Pixels), new Measurement(200, Unit.Pixels), Renderers.Png);


var imageStream = geometry.AsImage(new Measurement(200, Unit.Pixels), new Measurement(200, Unit.Pixels), Renderers.Png);

This is great!

Only issue I’m now having is that I’m not able to determine the color of the renderd shape, how can I set the line and fill color of the shape . I’m working with Crop fields and each color represent the crop on that field .

One example of a png file renderd is attached.13608.png (1.9 KB)

1 Like


We will check and get back to you soon.

1 Like

Hi, @mcanavar
Please consider code below to determine the color of the rendered shapes, lines, points

        //use to write in stream
        var imageStream = new MemoryStream();
        AbstractPath path = AbstractPath.FromStream(imageStream);
        //use to write in file
        //AbstractPath path = AbstractPath.FromLocalPath(outputPath);

        // styles 
        var lineSymbolizer = new SimpleLine { Width = 1.5, Color = Color.DarkSlateBlue };
        var polygonSymbolizer = new SimpleFill { FillColor = Color.Azure, StrokeColor = Color.Brown };
        var pointSymbolizer = new SimpleMarker { FillColor = Color.Aqua, StrokeColor = Color.Red };
        var symbolizer = new MixedGeometrySymbolizer();
        symbolizer.LineSymbolizer = lineSymbolizer;
        symbolizer.PointSymbolizer = pointSymbolizer;
        symbolizer.PolygonSymbolizer = polygonSymbolizer;

        // render
        geometry.AsImage(this, path, Measurement.Pixels(200), Measurement.Pixels(200), Renderers.Png, symbolizer);

All feature to render: Symbology|Documentation (aspose.com)


1 Like

Hi @Evgeniy.Timofeev,

This is what I was looking for, thank you for the example .
Apologies that I overlooked the thirt override of the AsImage function with the symbolizer property.

Kind Regards,

PS: Perhaps the property symbolizer of the AsImage function should be optional for or all three of the override function . .

Hi, @mcanavar

The symbolizer property has been added in all methods. The Ticket ( GISNET-1335) has been completed in Aspose.GIS for .NET 22.06 . Please feel free to contact us if you have any other issues or difficulty using the product.

1 Like