using (var dataset = Dataset.Open(path, Drivers.FileGdb, options))
{
Console.WriteLine("FileGDB has {0} layers", dataset.LayersCount);
for (int i = 0; i < dataset.LayersCount; ++i)
{
Console.WriteLine("Layer {0} name: {1}", i, dataset.GetLayerName(i));
using (var layer = dataset.OpenLayerAt(i))
{
//1.Aspose.Gis.GisException:“Invalid geometry: LinearRing should be closed (first point should equal to the last one)”
layer.SaveTo($"xx.geojson", Drivers.GeoJson, new SavingOptions()
{
DriverOptions = new GeoJsonOptions()
{
XYPrecisionModel = PrecisionModel.Rounding(6)
}
});
Console.WriteLine("Layer has {0} features", layer.Count);
foreach (var feature in layer)
{
//2.here no exception throw
//3.how control XYPrecisionModel?
var t = feature.Geometry.AsText(WktVariant.ExtendedPostGis);
Console.WriteLine(t);
}
}
Console.WriteLine("");
}
q1:
code at label1 , will throw exception , but label 3 (feature.Geometry.AsText) no exception, and we can use gdal convert it to geojson success
q2:
how control label 3 (feature.Geometry.AsText) XYPrecisionModel? I pass FileGdbOptions in Dataset.Open , it seem not work