Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: VB.NET get Polyline from SHP

$
0
0
As you found out Coordinates is a list of all the coordinates of a feature. If you want to work with the different parts of a features geometry you can use the following code:
        For Each feature As IFeature In shapeActual.Features 'circle through the features
            For i As Integer = 0 To feature.BasicGeometry.NumGeometries - 1 'circle through the parts of one feature
                For Each coord As Coordinate In feature.BasicGeometry.GetBasicGeometryN(i).Coordinates() 'circle through the coordinates of the feature part
                    Dim AdresX = coord.X
                    Dim AdresY = coord.Y
                    pline.AddVertexAt(count, New Point2d(coord.X, coord.Y), 0, 0, 0)
                Next
            Next
        Next
No idea how your pline works, so make sure to not simply add all the points to the same pline like the code currently does. Otherwise you get the same result as before.

The posted code is based on DotSpatial 1.9. If you're using DotSpatial 2.0 remove the "Basic" from the posted code.

Viewing all articles
Browse latest Browse all 3973


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>