In this section, we're going to discuss queries and spatial queries using local content in the Runtime geodatabase.
Not only can you search online content, but you can also search through an ArcGIS Runtime geodatabase. However, in order to accomplish this, you can't use QueryTask
or FindTask
because they require a URI to an online data source. Also, you will need to access the local geodatabase's table instead of directly accessing the layer. To get access to the table, we must first open the ArcGIS Runtime geodatabase. Let's look at an example:
var gdb = await Geodatabase.OpenAsync(this.GDB); Envelope extent = null; foreach (var table in gdb.FeatureTables) { var flayer = new FeatureLayer() { ID = table.Name, DisplayName = "Parking Meters", FeatureTable = table };
You've seen this code before. It simply opens a Runtime geodatabase (SQL Lite), and then creates a FeatureLayer
resource. Let's create some code to search for a parking meter...