AnsweredAssumed Answered

QML Querying a Geodatabase Offline

Question asked by Rneel_DevTest on Oct 1, 2017
Latest reply on Nov 27, 2017 by aneeqa.abrar

I'm figuring out the workflows for an AppStudio app that involves a query of the current GPS location against a feature service of polygons. I've got it working for a feature service in ArcGIS Online, but need to work out how to make this an Offline operation, since connectivity could be an issue. 

 

I've explored the examples for generating Runtime Content in ArcMap (a .geodatabase file), sample code below. With a featuretable declared, I assumed that I could query against that, but I get no data in my result. One clue is that get an error: "Unable to assign [undefined] to QmlFeatureTable", even on the stock Esri example code, for the "featureTable:" line. Their data appears on the map, but I nothing I've tried, as far as querying features, seems to work. 

 

I'm not concerned about map display, I need to execute a query against a layer of polygons, as I would using the REST API, to see if my GPS "point" gets a return. Is there an established way to get there? I'm still a rookie with using QML/Javascript with AppStudio, so I could be missing something basic.

Also worth mentioning, I've looked at the MobileMapPackage process, as well; I like that since I can easily generate it in ArcGIS Pro, but have had no luck querying against that, either. 

 

Thanks for any info! 

 

--Ray

 

Sample code:

 

QueryParameters {
   id: params
}

 

FeatureLayer {
   // obtain the feature table from the geodatabase by name
   featureTable: gdb.geodatabaseFeatureTablesByTableName["Trailheads"]

   // create the geodatabase
   Geodatabase {
      id: gdb
      path: AppFramework.resolvedPathUrl(copyLocalData(inputGDB, outputGDB))
   }

   onLoadStatusChanged: {
      console.log( "Load Status: ", loadStatus );
      params.whereClause = "1=1";

      featureTable.queryFeatures( params );

      onQueryFeaturesStatusChanged: {
         console.log( JSON.stringify( FeatureQueryResult ));
      }
   }
}

Outcomes