ThinkGeo.com    |     Blog    |     Wiki    |     Support

ThinkGeo V12 How to Load FileGeoDatabaseFeatureLayer

ThinkGeo Team,

I’ve begin the process to upgrade from MapSuite V10.5 to ThinkGeo Core V12.1.

I would appreciate assistance on how to implement FileGeoDatabaseFeatureLayer as it has changed from MapSuite. I attempted to use your API Documentation Guide. Searching for FileGeoDatabaseFeatureLayer returns 7 Hits, but pressing the link returns unrelated information.

Below are screen-captures of the search results and result of pressing the link.

It appears that the fundamental methodology of integrating FileGeoDatabaseFeatureLayer has changed.

The GetTableNames API no longer exists.

The constructor for FileGeoDatabaseFeatureLayer has changed.

The basic code for V10.5 is:

TheDatabaseTableNames = FileGeoDatabaseFeatureLayer.GetTableNames(TheFilePath);

foreach (string TheTableName in TheDatabaseTableNames)
{
    TheFileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(TheFilePath, TheTableName, "OBJECTID");

    at this point styles are applied and layer loaded into map
}

In order for the above code to work it uses GetTableNames, which no longer exists. In order to load each layer within the GDB how are the table names determined?

Since the constructor has changed is the following the proper code for Core V12.1?

TheFileGeoDatabaseFeatureLayer                    = new FileGeoDatabaseFeatureLayer(TheFilePath);
TheFileGeoDatabaseFeatureLayer.Name               = TheTableName;
THeFileGeoDatabaseFeatureLayer.FeatureIdFieldName = "OBJECTID";

The Start Building with ThinkGeo guide lists a few changes between MapSuite and Core, but is there a comprehensive document that details all changes with examples of how to convert to V12?

I downloaded HowDoISamples-ForWPF.NETCore-master.zip and have found som3 good examples.

Regards,
Dennis

Hi Dennis,

It should looks like this:

     FileGeoDatabaseFeatureLayer TheFileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer("TheFilePath");
    Collection<string> tables = TheFileGeoDatabaseFeatureLayer.LayerNames;
    foreach (string TheTableName in tables)
    {
        TheFileGeoDatabaseFeatureLayer.ActiveLayer = TheTableName;
    }

You just need to load one time, and then each table is a inner layer, you can set the ActiveLayer to specified table.

Regards,

Ethan

Ethan,

Thanks for the response.

What is an ActiveLayer?

I have ten layers in one GDB all of which are visible and all requiring difference styles. How are the individual styles applied?

What is the reasoning for changing this for ThinkGeo Core?

Thanks,
Dennis

Hi Dennis,

The ActiveLayer is the table you are loading now, you can dynamic modify its value and the map will load data from different layers each time when it get refresh.

But if you want to shows different tables in same FileGeoDatabase at the same time, you need build different FileGeoDatabaseFeatureLayer for example:

        FileGeoDatabaseFeatureLayer fileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer("../../../AppData/Shapes.gdb");
        fileGeoDatabaseFeatureLayer.Open();
        fileGeoDatabaseFeatureLayer.ActiveLayer = "cities";


        FileGeoDatabaseFeatureLayer fileGeoDatabaseFeatureLayer2 = new FileGeoDatabaseFeatureLayer("../../../AppData/Shapes.gdb");
        fileGeoDatabaseFeatureLayer2.Open();
        fileGeoDatabaseFeatureLayer2.ActiveLayer = "states";

Because version 12 is totally new version, we modify it is for make it easier to understand and use.

Regards,

Ethan