MapImageLayer - 具有查询表的动态数据图层

尝试一下在线预览

这个示例演示了如何在 MapImageLayer 中添加具有 查询表数据源 要素的 子图层

 QueryTableDataSource 可用于动态呈现没有相关地理数据库的空间表。它还可用于复杂的 SQL 查询,例如对包含与空间表中的要素匹配的多条记录的非空间表执行连接的查询。查询 参数可用于过滤表,以便表中的记录与空间表中的记录之间仅存在一对一的关系。

表或要素类必须存在于 Map Server 上已注册的动态工作区中。在这个示例中,我们从一个包含注册到动态工作区的要素类的地图服务创建一个 MapImageLayer  。这些要素类不是服务图层。因此,如果您想在视图中可视化它们,我们需要 动态呈现 它们。为此,您必须将子图层的 属性设置为 数据层 类型,并将 数据源 设置为查询表

             
1
2
3
4
5
6
7
8
9
10
11
12
13
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"
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.