When constructing a web tool or geoprocessing service, the output symbology and the coordinate system of the data are important. When the tool successfully runs and creates output, your job as the author of the tool is complete. To construct an efficient tool for use on the web, an illustrative symbology and a proper coordinate system can enhance the experience for the consumer of your tools.
Output symbology
Web tools and geoprocessing services that provide geographic output can have results drawn in one of the following two ways:
- The client is sent the result features and draws them.
- The client is sent a map image from a map service that has drawn the image on the server.
Note:
The client consuming a web tool or a geoprocessing service cannot request for the result as a map image unless the service has been set up using the result map image layer option. The publisher or administrator of the service must have enabled this setting before the consumption of the web tool.
Client draws the output
By default, a web tool returns the output features from a successful tool run to the client. It is up to that client to draw or render those features on a map. In the ArcGIS Maps SDK for JavaScript, the code must get the result, set a renderer, and draw the result as defined by the web app creator. With desktop applications, they will get and draw the features from the web tool. The client can change the symbology as they interact with it.
Server returns a map image
When creating a web tool, you can opt to view the output as a map image when the service is set to run asynchronously. The output features from the service will be drawn as a map image and that image will be returned to the client. In this situation, the features are not usually returned because the service publisher may have set that no features can be returned. Creating the result on the server and returning the map image is useful for a variety of cases, such as the following:
- When it is impractical to send large data such as big rasters or a large number of features back to a client.
- When the output features cannot be drawn in the client. For example, a raster (.tif) cannot be drawn in a web app.
- When the client cannot draw or render to a high cartographic quality. The map image maintains the same symbology settings of the output result at the time it was published.
Coordinate systems
Every dataset a web tool or a geoprocessing service processes must have a coordinate system. Generally, all the data the tool processes will be in the same coordinate system. However, there are situations when you need to be aware of the coordinate systems of your data and modify the data.
When constructing a web tool that will output features to be drawn on a web app, you may or may not want to generate your data in a specific spatial reference. Geoprocessing tools process and output data based on the coordinate system of the input unless the output coordinate system of the particular tool has been defined.
The geoprocessing service of the web tool has the option to accept an output coordinate system value. At the time the tool is run on the server, the client application can tell the service to return the output in a specific coordinate system. Processing is done based on the coordinate system of the input, and consequently the output will be in the same coordinate system. Environment variables allow the processing to continue in the given coordinate system, but the server will project the data as needed and return the final output in the coordinate system of your choice. See the context parameter on how to set the outSR as the output spatial reference at REST for synchronous geoprocessing services, and context parameter for asynchronous geoprocessing services.