ThinkGeo.com    |     Documentation    |     Premium 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

hi Ethan,

I basically have this working, however, have noticed a difference between V10.5 & V12.1.

One area that was changed from V10.5 to V12.1 was how the initial list of database table names is acquired. Below are two screen captures that show the difference in the returned table names even though both the V10.5 & V12.1 applications are using the same data files.

The below list of tables is from V10.5. Notice he leading back-slash and the leading \CDA.
image

The below list of table is from V12.1. Notice that the leading back-slash is not present, the leading \CDA is also not present on the two GATE_POINT names. A
image

In the following thread I had suggested that MapSuite remove the leading back-slash from each of the table names. In your zeal to do so the “CDA” was also removed. I would have thought that just a leading back-slash would have been removed as CDA is part of the layer name.

Thanks,
Dennis

Hi Dennis,

Thanks to let us know it.

I think our developer will look into it and fix it if that’s make sure a bug.

Any update I will let you know.

Regards,

Ethan

Hi Dennis,

Our developer research about it.

We found the CDA is not a part of table, it should be the other dataset type. In original version it’s necessary if you want to access target table, but in V12 you can directly access the table by its name, so we think that’s not useful now.

We compare some other utility also, it looks the new result is the same like the other utility.

If you still need to use it in your project, could you please let us know your scenario, so our developer can help you solve this problem?

Regards,

Ethan