The queryGroupLayer in ArcWeb Explorer JavaScript and Flex APIs allows users to create maps with custom data or ESRI-provided data. In a traditional mashup, application developers need a database that stores their data and they must write the logic for intelligently retrieving relevant points from the database depending on the extent and scale. For example, consider a custom dataset that describes a retailer’s store locations in the United States. In a traditional mashup, the application developer needs a database to store all this information and must implement logic to extract points according to map interaction. For instance, if the end user has zoomed into New York City, then the logic must retrieve only store locations in New York City.
The queryGroupLayer consumes only point-based SpatialQuery data sources (not lines or polygons). To create your own SpatialQuery data source, see Building spatial query services. The ArcWeb Explorer JavaScript API uses a spatially aware mechanism to return only the results that are relevant to the area the user is currently viewing. The fact that no database is needed and no retrieval logic is required to be coded significantly reduces the effort it takes to build your mashup with ArcWeb Explorer JavaScript API. Parameter descriptions for the queryGroupLayer are documented in group layers.
The queryGroupLayer supports the use of a WHERE clause to filter data and only retrieve and display features that satisfy certain criteria. By default, the 10 points closest to the map center display. You can change the number of points using the “count” option. A live sample of this functionality is provided in the Query Group Layer sample. This query can be changed dynamically depending on the current extent and scale of the map.
For the JavaScript API, the getLatLonExtent() and getScaleForLatLonExtent() methods of AWMap can be used to get the current state of the map.
In addition to custom databases, the queryGroupLayer can be used with datasets provided by ESRI. The field names to use in the WHERE clause can be obtained by viewing data source details for the links below. See Spatial Query codes for a list of codes for these data sources. Parameter descriptions for the queryGroupLayer are documented in group layers.