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

Free Support Forum - aspose.com

Option to be able to use geojson feature of featurecollection


From a rest-service I can retrieve single or multiple geojson features as text .
example of singele feature (shortend) :

{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[135099.3841000013,482298.6171000004] ...]]},"properties":null,"id":1823}

Example of multiple features in geojson text .

{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[135099.3841000013,482298.6171000004] ...]]},"properties":null,"id":1823},
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[135099.3841000013,482298.6171000004] ...]]},"properties":null,"id":1824}]}

Can I use Aspose.Gis to convert from geoJson feature to Geometry ( IGeometry) .
Can I use Aspose.Gis to use the input geoJson feature to render to an image / png/ toImage function.

Hope you can help.


Hi, @mcanavar

I need to explore your request. I’ll be back with an answer after the weekend.


1 Like

Hi ,
Any info on my query about use of geojson .

Thank you.

Hi, @mcanavar

First you need to write each feature from multiple features in own text file.

File.WriteAllText("feature_i.json", content[i])

Second you need to open layers to handle the geometry of feature

using (var layer = Drivers.GeoJson.OpenLayer("feature_i.json"))
    // handle feature
    var feature = layer[0];

Also you can render yuor layers to Svg\Jpeg\Bmp

using (var map = new Map(800, 400))
    map.Add(VectorLayer.Open(dataDir + "feature_1.json", Drivers.GeoJson));
    map.Add(VectorLayer.Open(dataDir + "feature_2.json", Drivers.GeoJson));
    map.Render(dataDir + "map.svg", Renderers.Svg);

More info: Map Rendering to Image SVG, PNG, JPG using GIS C# Library|Documentation (aspose.com)

Best regards

Hi @Evgeniy.Timofeev,

Thank you for your input. Basically you are saying that this only works if the json retrieved from the database, so in memory , has to be written to a fiscal file to be able to use the data .

This will / would be ok if it was to be used occasionally, but when using it iterating trough a database recordset I think it would perform poorly.

To be able to skip the save to a file part would be an huge improvement of usability for me.


The library can work with formats in memory: https://docs.aspose.com/gis/net/streams-and-remote-storage/#read-a-file-from-a-stream

Please feel free to contact us if you have any other issues or difficulty using the product.