Best way to query a layer in a local runtime .geodatabase file?

3758
2
Jump to solution
12-12-2015 09:17 PM
IanBroad
New Contributor III

I need to develop a mobile app that accesses a local runtime .geodatabase file. I cannot use a service layer.

I'm just getting familiar with the Qt SDK (QML), and I like what I see.

For the app, my data consists of 1 large polyline layer split into many (20,000) individual sections. What I need the app to do is fairly basic:

Query a polyline layer for a value range (ex: query ± %5 of value), then buffer the results, symbolize the buffered results with 3 class breaks (red closest to value, then orange, and yellow for within the 5%), zoom to the buffered areas.

My question is:

What's the best way to query and buffer the layer?

Right now I'm using:

Query {
     id: query
     outfields: ["*"]     
}

function runQuery() {
     query.where = "myField = 'test'";
     myFeatureLayer.selectFeatureByQuery(query);

}

And on the FeatureLayer I have:

FeatureLayer {
  id: myFeatureLayer
  featureTable: GeodatabaseFeatureTable {
       id: myFeatureTable
       geodatabase: gdb.valid ? gdb : null
       featureServiceLayerId: 0
  }
  onSelectedFeaturesChanged:
       zoomToSelected()
}
0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Ian,

Here is what I would do:

1) Run a queryFeatures against the GeodatabaseFeatureTable - ArcGIS Runtime SDK for Qt QML API: FeatureTable Class Reference

2) The queryFeatures result will return an FeatureResult, which has an iterator of features (FeatureQueryIterator - ArcGIS Runtime SDK for Qt QML API: FeatureQueryIterator Class Reference)).

3)  Use a while loop to loop through the iterator while the iterator hasNext. This will give you access to the resulting feature. The feature has geometry - ArcGIS Runtime SDK for Qt QML API: Feature Class Reference

4) Once you have the geometry, you can directly call buffer() on the geometry, which will give you the output polygon geometry ArcGIS Runtime SDK for Qt QML API: Geometry Class Reference

5) Create a Graphic and  add it to a GraphicsLayer. Use the buffer geometry for the graphic's geometry, and use a Renderer or a SimpleFillSymbol for the Graphics symbol.

Hope this helps.

Thanks,

Luke

View solution in original post

2 Replies
LucasDanzinger
Esri Frequent Contributor

Ian,

Here is what I would do:

1) Run a queryFeatures against the GeodatabaseFeatureTable - ArcGIS Runtime SDK for Qt QML API: FeatureTable Class Reference

2) The queryFeatures result will return an FeatureResult, which has an iterator of features (FeatureQueryIterator - ArcGIS Runtime SDK for Qt QML API: FeatureQueryIterator Class Reference)).

3)  Use a while loop to loop through the iterator while the iterator hasNext. This will give you access to the resulting feature. The feature has geometry - ArcGIS Runtime SDK for Qt QML API: Feature Class Reference

4) Once you have the geometry, you can directly call buffer() on the geometry, which will give you the output polygon geometry ArcGIS Runtime SDK for Qt QML API: Geometry Class Reference

5) Create a Graphic and  add it to a GraphicsLayer. Use the buffer geometry for the graphic's geometry, and use a Renderer or a SimpleFillSymbol for the Graphics symbol.

Hope this helps.

Thanks,

Luke

IanBroad
New Contributor III

Awesome, thanks for your help!

0 Kudos