I'm trying to read a shapefile and draw it using DirectX and GDAL library. So first I will read the shapefile and get a list of all the points in the shapefile. It works with linestring using GetPoint()
.
var polylines = new ConcurrentDictionary<string, List<Point3D>>();
Feature feat;
while ((feat = layer.GetNextFeature()) != null) {
var geom = feat.GetGeometryRef();
var points = new List<Point3D>();
for (var i = 0; i < geom.GetPointCount(); i++)
{
double[] geopoint = {0, 0, 0};
geom.GetPoint(i, geopoint);
points.Add(new Point3D(geopoint[0], geopoint[1], geopoint[2]));
}
polylines.TryAdd(feat.GetFID().ToString(), points);
feat.Dispose();
}
But when the geometry is MultiLineString
then GetPoint()
, it always returns 0
. Does anyone know if there is a way to unpack MultilLineString
to LineString
or read MultiLineString
using GDAL?
Best Answer
So, after digging around. I finally found a way to unpack multilinestring.
This should also work with multipolygons.