ThinkGeo.com    |     Blog    |     Wiki    |     Support

FileGeoDatabase - Projection - Returns null

MapSuite Team,

The below code returns a null value for the projection string.

TheFileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(TheFilePath, TheTableName, "OBJECTID");
        
TheFileGeoDatabaseFeatureLayer.Open();
    
    TheProj4Projection = TheFileGeoDatabaseFeatureLayer.GetInternalProj4ProjectionParametersString();

Opening up some of the files of the GeoDatabase using notepad I can actually see the projection string.

The following code also returns a null:

Projection TheProjection = TheFileGeoDatabaseFeatureLayer.FeatureSource.Projection;

I am using ThinkGeo.MapSuite.Layers.FileGeoDatabase.11.0.0-beta009

The data has been uploaded to my ThinkGeo drive space at: home/Chicago_Data/GeoFileDatabase/Airport

Thanks,
Dennis

Hi Dennis,

It looks the return value is correct.

If you are using any other table please let me know.

Regards,

Ethan

hi Ethan,

The below line of code returns a collection of table names. However, each name is preceded by a back-slash character as shown below in my application datagrid. My application programmatically used the names in the collection as-is. The problem is the back-slash. If the back-slash is present methods such as GetFirstFeaturesWellKnownType and GetInternalProj4ProjectionParametersString do not work. Remove the back-slash, as I’m now doing programmatically, and everything works.

Collection<string> TheGeoDatabaseTableNames = FileGeoDatabaseFeatureLayer.GetTableNames(ThePath);

To prevent future confusion it would be advisable to modify MapSuite GetTableNames such that leading back-slash is not included.

Thanks,
Dennis

Hi Dennis,

Thanks for your suggestion, I am not sure why the first slash is keep here, but I will let our development team knows your suggestion about it.

For now I think you can use this line to make it works in your scenario:

var tables = FileGeoDatabaseFeatureLayer.GetTableNames("../../AppData/Airport").Select(x => x.TrimStart('\\')).ToList();

Wish that’s helpful.

Regards,

Ethan