MapImageLayer - dynamic data layer with query table

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to add a sublayer with features from a query table data source in a MapImageLayer.

The QueryTableDataSource can be used to dynamically render a spatial table that doesn't have an associated geodabase. It can also be used for complex SQL queries, such as those that perform joins to non-spatial tables containing multiple records that match to features in the spatial table. The query parameter may be used to filter the table so that only a one-to-one relationship exists between records in the table to those in the spatial table.

The table or feature class must exist in a registered dynamic workspace on your Map Server. In this sample, we create a MapImageLayer from a map service containing feature classes registered to a dynamic workspace. These feature classes are not service layers. Therefore we need to dynamically render them if you want to visualize them in the view. To do so, you must set the source property of the sublayer as a data-layer type and set the dataSource to query-table.

source: {
  type: "data-layer",
  dataSource: {
    type: "query-table",
    workspaceId: "MyDatabaseWorkspaceIDSSR2",
    // Select all the records in the Places feature class
    // where the class of the feature is 'city'
    query: "SELECT * FROM ss6.gdb.Places WHERE class = 'city'",
    spatialReference: { wkid: 4326 },
    geometryType: "point",
    oidFields: "objectid"
  }
}

Sample search results

TitleSample

There were no match results from your search criteria.