require(["esri/layers/QueryDataSource"], function(QueryDataSource) { /* code goes here */ });
Description
(Added at v2.7)
The QueryDataSource class defines and provides information about a layer or table that is defined by a SQL query. The geometry storage format determines the capabilities of the QueryDataSource. If the data source stores the geometry in the database native format the return value is a layer that supports all operations supported by a dynamic layer. If the data source stores geometry in a non-native format the result is a table that can be used to perform query operations.
See also
Samples
Search for
samples that use this class.
Class hierarchy
esri/layers/DataSource
|_esri/layers/QueryDataSource
Constructors
Properties
Methods
toJson() | Object | Converts object to its ArcGIS Server JSON representation. |
Constructor Details
Creates a new QueryDataSource object.
Parameters:
<Object > json |
Optional |
JSON object representing the QueryDataSource. |
Sample:
require([
"esri/layers/QueryDataSource", ...
], function(QueryDataSource, ... ) {
var dataSource = new QueryDataSource();
...
});
Property Details
The geometry type of the data source. Required if the specified data source has a geometry column.
Known values: 'point' | 'multipoint' | 'line' | 'polygon'
Sample:
dataSource.geometryType = "polygon";
An array of field names that define a unique identifier for the feature. The combiniation of one or more fields will be used to generate a unique identifier for the feature.
Sample:
dataSource.oidFields = ["TaxLotId"];
The SQL query string that defines the data source output.
Sample:
dataSource.query = "SELECT * FROM sde.sde.states_geom";
The spatial reference for the data source. Required if the specified data source has a geometry column.
Sample:
require([
"esri/layers/QueryDataSource", "esri/SpatialReference", ...
], function(QueryDataSource, SpatialReference, ... ) {
var dataSource = new QueryDataSource( ... );
dataSource.spatialReference = new SpatialReference({
wkid: 4269
});
...
});
The workspace id for the registered file geodatabase, SDE or Shapefile workspace.
Sample:
dataSource.workspaceId = "d203_db";
Method Details
Converts object to its ArcGIS Server JSON representation.