Free Support Forum - aspose.com

ESRI File Geodatabase

Dear team,
ESRI File Geodatabase seems to bi nice container for different layers. Is it possible to add non-geographical tables into dataset?
Thanks, Miro M.

Hi, @geomir

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

Please feel free to contact us if you have any other ideas.

Hello, in fact you already have such data example: “ThreeLayers.gdb”, but there is no complete corresponding code. I found examples how to create “layer1” and “layer2”, missing only example how to create “layer3”. Preferred c# code.
Best regards, Miro M.

Thank you for pointing that out.

Please consider the below code to create a non-geographical table into a dataset. In fact, this is possible if the geometry of the features is not specified.

        using (var dataset = Dataset.Create(path, Drivers.FileGdb))
        {
            using (var layer = dataset.CreateLayer("layer_3"))
            {
                // defines an attributes schema
                layer.Attributes.Add(new FeatureAttribute("Title", AttributeDataType.String));
                layer.Attributes.Add(new FeatureAttribute("Number", AttributeDataType.Integer));

                // we don't setup geometries to create non-geographical tables into dataset
                // add one.
                var feature0 = layer.ConstructFeature();
                feature0.SetValue("Title", "Hello");
                feature0.SetValue("Number", 1);
                layer.Add(feature0);

                // add more
                var feature1 = layer.ConstructFeature();
                feature1.SetValue("Title", "Word");
                feature1.SetValue("Number", 2);
                layer.Add(feature1);
            }
        }

Best regards

Hello, no, it doesn’t work. Layer 3 is shown as Point Layer.
Best regards, Miro M.

I have reproduced this error and have changed the task GISNET-596.

        using (var dataset = Dataset.Open(outputPath, Drivers.FileGdb))
        {
            using (var layer = dataset.OpenLayerAt(0))
            {
                // 'GeometryType.Null' is expected but it is shown as Point Layer
                var geometryType = layer.GeometryType;
            }
        }

Thanks