Create contour lines from local raster data using a local geoprocessing package .gpk
and the contour geoprocessing tool.
For executing offline geoprocessing tasks in your apps via an offline (local) server.
Contour Line Controls (Top Left):
- Interval - Specifies the spacing between contour lines.
- Generate Contours - Adds contour lines to map using interval.
- Clear Results - Removes contour lines from map.
- Create and run a local server with
LocalServer.Instance
. - Start the server asynchronously with
server.StartAsync()
. - Start a
LocalGeoprocessingService
and run aGeoprocessingTask
.- Instantiate
LocalGeoprocessingService(Url, ServiceType)
to create a local geoprocessing service. - Call
LocalGeoprocessingService.StartAsync()
to start the service asynchronously. - Instantiate
GeoprocessingTask(LocalGeoprocessingService.Url + "/Contour")
to create a geoprocessing task that uses the contour lines tool.
- Instantiate
- Create an instance of
GeoprocessingParameters
.- Instantiate
GeoprocessingParameters(ExecutionType)
creates geoprocessing parameters. - Create a parameter using
gpParams.Inputs["ContourInterval"] = new GeoprocessingDoublevalue)
using the desired contour value.
- Instantiate
- Create and start a
GeoprocessingJob
using the previous parameters.- Create a geoprocessing job with
GeoprocessingTask.CreateJob(GeoprocessingParameters)
. - Start the job with
GeoprocessingJob.Start()
.
- Create a geoprocessing job with
- Add contour lines as an
ArcGISMapImageLayer
to the map.- Get url from local geoprocessing service using the
service.Url
property. - Get server job id of geoprocessing job using the
GeoprocessingJob.ServerJobId
property. - Replace
GPServer
from url withMapServer/jobs/jobId
, to get generate contour lines data. - Create a map image layer from that new url and add that layer to the map.
- Get url from local geoprocessing service using the
- GeoprocessingDouble
- GeoprocessingJob
- GeoprocessingParameter
- GeoprocessingParameters
- GeoprocessingTask
- LocalGeoprocessingService
- LocalGeoprocessingService.ServiceType
- LocalServer
- LocalServerStatus
This sample downloads the following items from ArcGIS Online automatically:
- Contour.gpkx - A Geoprocessing Package for generating contour lines.
- RasterHillshade.tpkx - A tile package for the hillshade.
Local Server can be downloaded for Windows and Linux platforms from the developers website. Local Server is not supported on macOS.
geoprocessing, local, offline, parameters, processing, service