ThinkGeo.com    |     Documentation    |     Premium Support

V10 - GeoDataTable - Get BaseShape of ShapeFileFeatureLayer

MapSuite Team,

If a GeoDataTable is populated with the features corresponding to an SqliteFeatureLayer the following code will get the BaseShape of the Feature.

Dictionary<string, object> TheFeatureRow = TheGeoDataTable.Rows[0];
byte[]           TheGeometry     = (byte[])TheFeatureRow["geometry"];
BaseShape TheBaseShape    = MultilineShape.CreateShapeFromWellKnownData(TheGeometry);

If a GeoDataTable is populated with the features corresponding to a ShapeFileFeatureLayer how does one get the BaseShape of the Feature for any given Row?

Thanks,
Dennis

Hi Dennis,

For shape file we suggest you query shape then you can find the values in its column values.

But if you want to do that just like query in database, please view the code as below:

        GeoDataTable TheGeoDataTable = shapeFileLayer.FeatureSource.ExecuteQuery("select * from states.dbf");
        Dictionary<string, object> TheFeatureRow = TheGeoDataTable.Rows[0];
        Feature f = shapeFileLayer.FeatureSource.GetFeatureById(TheFeatureRow["RECID"].ToString(), ReturningColumnsType.AllColumns);
        BaseShape TheBaseShape = f.GetShape();

And here is the sample which works well.8706.zip (101.1 KB)

Regards,

Ethan