Brian2000

ArcGIS JavaScript API: Understanding the Query Task

The Query Task is probably the single most important class in the ArcGIS Server Javascript API. Understanding how to access data from the server and how to manipulate it is the cornerstone to developing any GIS application.

There are a few examples within ESRI’s sample page, however I wanted to provide two examples outlining how I use the Query Task on a regular basis.

Example #1 shows how to use the Query Task’s where clause and pull data directly from a map service. ESRI’s provides a similar example, however it requires the user to submit a query within the page. My example allows you to have the query pre-canned and the results load with the page.

Example #2 takes this a step further and introduces the ability to access the same functionality via POST or GET. This is perfect for anyone interested in loading data into the page via URL variables (example2.php?name=Idaho) or perhaps someone that would like to call this function via AJAX.

I use example #2 all the time, so hopefully you’ll find it as useful as I do.

DOWNLOAD: EXAMPLES 1 & 2

*All data is provided via ESRI's hosted map services. Example 2 requires PHP.

Stamen’s new basemaps are beautiful

Stamen recently released a set of free open source web mapping services that are both fast and beautiful.

Watercolor (my favorite) is a great map service for anyone looking to add some artistic flare to their maps. The basemap incorporates hand-painted brush textures and high-level cartographic algorithms to create a map that honestly looks like someone sat down and pained every inch of the planet in watercolor. The map is absolutely stunning.

Terrain is the perfect open-source alternative to Google’s terrain map. It looks great at all zoom levels and visually has the birds-eye effect fully locked in.

Toner is a wonderful basemap for anyone providing a print page for their maps. It’s designed using only black and white with focus on labeling and textures. You can really make a dataset pop against it if you add a splash of color, like selecting a building in red – for example.

Stamen has made these services available for the following APIs: Google Maps, OpenLayers, Leaflet, & ModestMaps