Geodatabase returns empty GeodatabaseFeatureTables collection

3405
16
08-08-2017 10:29 AM
JoeHershman
MVP Regular Contributor

I have come across a number of cases where the Geodatabase object has an empty collection of GeodatabaseFeatureTables.  I have gone back and recreated everything from scratch, sometimes I have seen it fix the issues others not.  When generating these replicas everything goes fine, I have checked Server logs and these only contain debug/info messages.  Nothing indicative of errors.  I can open the databases in DB Browser for SQLLite and everything looks fine.

After a bunch of research I have found one difference.  The databases that work all seem to have a table called GDB_ServiceItems.  The databases that show no layers none appear to have this table.

So a question, would this table missing cause the API to behave in this manner?  Does the initialization of the Geodatabase object look to this table for information about the tables?

-Joe

Thanks,
-Joe
16 Replies
NathanMellor
Occasional Contributor

I just came here to post the same question. Hope we get some answers. 

I've only tried one so far and it is coming up empty. It should have five layers. Also seems to have plenty of stuff. 

I don't have a lot of Geodatabases to try. I'm hiring a person for ArcGIS desktop and asked them to follow the instructions here and here:

Create an offline layer—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Creating ArcGIS Runtime content—Help | ArcGIS Desktop 

The .geodatabase  was created from data here. I'm happy to attach it if it helps: 

http://services3.arcgis.com/IKBBLZOXy58PXgpl/ArcGIS/rest/services/Arizona_National_Scenic_Trail_Laye... 

I'd like to know if the technician is doing something wrong or if I am programming something wrong. 

I'll note that I have not found an exact example in 100.1 for opening a local geodatabase. 

The code I have used is this. It crashes when it gets to the foreach loop because the list of feature tables is empty. There are no useful logs of any failure when opening it. 

       

private async void Initialize()
         {
                   string filename = Android.OS.Environment.ExternalStorageDirectory.Path + Java.IO.File.Separator + "agisdata" + Java.IO.File.Separator + "featureserver.geodatabase";
 
             Geodatabase gdb = await Geodatabase.OpenAsync(filename);
             // Get all of the GeodatabaseFeatureTables from the geodatabase. They will be used to construct a FeatureLayer later.
 
 
             // Loop through each of the GeodatabaseFeatureTables and get its Name and ID to display that in a ListBox that user can then select and add to the Map as a FeatureLayer. 
             foreach (GeodatabaseFeatureTable oneFeatureTable in gdb.GeodatabaseFeatureTables)
             {
           
                 FeatureLayer myFeatureLayer = new FeatureLayer(oneFeatureTable
 
                 // Add the FeatureLayer to the Map.
                 myMap.OperationalLayers.Add(myFeatureLayer);
             }
 
 
 
             
 
 
         }
0 Kudos
JoeHershman
MVP Regular Contributor

Something I tried which seems to be working.  When doing the replica download I used the internal url of the service instead of the Web Adapter url.  So instead of https://machine.domain.com/server/rest/services/MyService/FeatureServer.  I used https://machine.domain.com:6443/arcgis/rest/services/MyService/FeatureServer.  When I did this the replica was created correctly.

Thanks,
-Joe
0 Kudos
NathanMellor
Occasional Contributor

Do you mean when you are using GeoDatabaseSyncTask? Or is this something you do on ArcMap? 

I see that might be helpful if I have any idea what the internal url of a service is. I have no idea for this one. 

http://services3.arcgis.com/IKBBLZOXy58PXgpl/ArcGIS/rest/services/Arizona_National_Scenic_Trail_Laye... 

I'm disappointed that ESRI hasn't weighed in on this. Either there are some undocumented steps that need to be done on the server or the desktop, some undocumented steps that must be done when opening the .geodatabase, or some undocumented bugs. 

Being able to read from a local offline geodatabase is an absolute requirement and a big reason to use this runtime. 

All the documentation seems to indicate this is possible, but so far I can not experience it. 

0 Kudos
NathanMellor
Occasional Contributor

I have experienced the same with the tables. 

The sample geodatabases I've used successfully have the GDB_service items. The one I had created in ArcMap did not.

I found this screenshots which I believe is for the settings for the export. Are there other settings that may affect this?

Feature and tabular data settings.

0 Kudos
NathanMellor
Occasional Contributor

And in case, it matters, I am only looking for a read only view of the data in a .geodatabase file. I'm not interested in syncing it back anywhere. My level of licensing wouldn't allow that anyway. 

0 Kudos
JoeHershman
MVP Regular Contributor

I am doing everything with internal services and not using online esri services, so I have more control over how to access them.  The solution I have does not seem possible using online esri services

Thanks,
-Joe
0 Kudos
NathanMellor
Occasional Contributor

I don't see anything in the topics about runtime content that we are only allowed to use internal services. 

I have the need to use data published by various government agencies. 

I see this as a bug or inadequate documentation.

We tried it with the Optimize for View Only setting and the table was still missing.

Interestingly, the ItemInfo field appears to be the sort of thing that you can get from a query like this.

 http://services3.arcgis.com/IKBBLZOXy58PXgpl/ArcGIS/rest/services/Arizona_National_Scenic_Trail_Laye...  

I found out she is using Arcmap 10.2.2 in case that makes a difference. 

0 Kudos
AnttiKajanus1
Occasional Contributor III

Hi guys,

I just noticed this topic and my take is that what is going on here is following: ArcMap is used to create a .geodatabase file through share as runtime content based on a Feature Service.

Fast googling indicates that ArcMap doesn't support generating .geodatabase files based on the feature services and they are only available through services pattern. I don't know if this limitation is in 10.2 but I would assume so (linked documentation is for 10.3)

Data from feature services and map services cannot be used. For more information on using services in ArcGIS Runtime SDKs, see Services pattern.

Creating ArcGIS Runtime content—Help | ArcGIS for Desktop 

Did I get the issue correctly? Also, note that the used service doesn't actually support sync which is used to create the replica when using `GeodatabaseSyncTask`. 

0 Kudos
NathanMellor
Occasional Contributor

That is something I require clarification on.

Because after saying that, it then gives instructions for including feature layers. I admit I am not an ArcMap user, only want to hire one - so I guess there could be other types of Feature Layers. 

And then it gives instructions for exporting tiles from a base map. How would it do that without using map services which it just said you couldn't use?

The sample geodatabases you provide seem to have come from a feature service. 

And indeed, we are getting data this way, it is just leaving out a few details, some of the time, that stop it from actually working. There are full tables of data with shape data on each row. 

I did try the GeodatabaseSyncTask with that service. It failed early on because the server doesn't support sync. I do not wish to make changes and sync with the server. I really only want to export but I don't see a way to tell it that. I don't think every Feature Server should have to allow anyone and everyone to sync data back to it in order to publish data that others can use. 

But now you have opened up a new line of thinking. 

When it links to "Services Pattern" I expected it to point to:

Create an offline layer—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Which describes Geodatabase SyncTask.

But instead, it points to:

Create an offline map—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Now I may have assumed that the GeodatabaseSync class was for vector layers while the OfflineMapTask was for tiled basemaps. Now not sure what to think. 

It says:

At the 100.1 release the OfflineMapTask supports the following services:

  • Tiled image raster services that have the exportTiles capability enabled.
  • Feature services that have sync enabled.
  • Feature collections.

Again, it wants the feature services to have sync enabled, so this one may fail too. Excuse my ignorance - I don't know what Feature Collections means in this context. The FeatureCollection class in the runtime can be created from a set of Feature Services. 


It has a Desktop pattern - I guess that you use ArcGIS Pro for this.  

It creates an MMPK file, which for all I know, may contain a .geodatabase inside it. 

Create an offline map—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

So what am I allowed to create a .geodatabase from? Shape files? File Geodatabases? Original works sketched in ArcGISMap?

Or do I even want to create a .geodatabase file? Maybe I want an mmpk file, especially if I don't want to sync back (and don't have a license to). 

Nathan

0 Kudos