Get Centerline length of (multi)polygon (collection)

Hi ,
I have been challenged to calculate length of a (multi)polygon shape or collection of shapes.

The length should be the centerline of the shape(s). Like this image e.g. (red is the centerline )
image.png (56.6 KB)

This can be a complex issue , could Aspose.Gis provide something like a centerline function to display and get the length of the centerline.

Regards,
Mehmet

Hi, @mcanavar

The task is very interesting. We are extending our set of geotools. First will we build a centerline polygon. Then we will calculate length.

I have created a ticket GISNET-1412 and update you here as soon as additional information is available.

Thanks

1 Like

Hi @Evgeniy.Timofeev,

It is interesting, reading into this topic of calculating length of the centerline ," Voronoi " method calculation comes up a lot.
Excited about your solution to this .

Regards,
Mehmet

The " Voronoi " method calculation is a good idea

Thank a lot.

1 Like

Perhaps a good example of an shape to test on : Look like this : image.png (24.1 KB)

GeoJson:example.7z (4.7 KB)

Thank you for sharing a good example.

Hi ,
Any update or hope that this will be available anytime soon?
Otherwise we will have to look for other means to solve this issue of ours.
Best Regards
Mehmet

Hi, @mcanavar

Yes, we have updates, we released feature “MakeVoronoiGraph” in our GeoTools. So, now we can build “Voronoi” diagram for collection of points.
Next step is calculate centerline length. We are going to release this in march.

Please check out our “MakeVoronoiGraph” feature. I hope it will be useful for you.

Thanks.

Hi @Alexander.Matveev ,

Fantastic news about the “MakeVoronoiGraph” feature in GeoTools!
Excited to explore its potential. Looking forward to the centerline length calculation release in March.

Thanks for the update!

Hi @Alexander.Matveev ,
Could you provide more details or documentation on how to use this new feature?
I couldn’t find any release notes and it seems I have missed some releases ?
image.png (15.9 KB)

Best,
Mehmet

Hi, @mcanavar

Apply “Voronoi” polygon to find lines equidistant from points. On start we have collection of points, using method we get collection of edges voronoi diagram.
Please use map.Render to see results.

These code examples for you:

List<Point> sites = new List<Point>();
      sites.Add(new Point(100, 100));
      sites.Add(new Point(200, 200));
      sites.Add(new Point(200, 100));
      sites.Add(new Point(100, 200));

      var edges = Gis.GeoTools.GeometryOperations.MakeVoronoiGraph(sites);
      var map = ProduceVoronoiMap(edges, sites);
      map.Render(MakePath("square") + ".map.png", Renderers.Png);

private Map ProduceVoronoiMap(List<LineString> edges, List<Point> sites, int mapSize = 300, int startExtent = 0)
    {
        // sites layer
        var sitesLayer = Drivers.InMemory.CreateLayer();
        foreach (var site in sites)
        {
            Feature feature = sitesLayer.ConstructFeature();
            feature.Geometry = site;
            sitesLayer.Add(feature);
        }

        // edges layer
        var edgesLayer = Drivers.InMemory.CreateLayer();
        foreach (var edge in edges)
        {
            Feature feature = edgesLayer.ConstructFeature();
            feature.Geometry = edge;
            edgesLayer.Add(feature);
        }

        var map = new Map(mapSize - startExtent, mapSize - startExtent);
        map.Extent = new Extent(startExtent, startExtent, mapSize, mapSize);
        map.BackgroundColor = Color.Beige;
        map.Padding = 0;

        map.Add(sitesLayer, new MixedGeometrySymbolizer()
        {
            PolygonSymbolizer = new SimpleFill() { FillColor = Color.Transparent, StrokeColor = Color.DimGray },
        });

        map.Add(edgesLayer, new MixedGeometrySymbolizer()
        {
            LineSymbolizer = new SimpleLine() { Width = 2, Color = Color.Green }
        });

        return map;
    }
1 Like