Create an elevation profile using a geoprocessing package executed with Local Server.
Applications that include Local Server are valuable in offline workflows that require advanced spatial analysis or data manipulation. This sample uses a geoprocessing package (.gpkx) created in ArcGIS Pro involving a custom geoprocessing model that includes the Interpolate Shape (3D Analyst) geoprocessing tool. The geoprocessing package is executed with ArcGIS Local Server.
You can generate elevation profiles to carry out topographical analysis of valley profiles, or visualize a hiking, cycling, or road trip over varied topography.
The sample loads at the full extent of the raster dataset. Click the "Draw Polyline" button and sketch a polyline along where you'd like the elevation profile to be calculated (the polyline can be any shape). Click the "Save" button to save the sketch and draw the polyline. Click "Generate Elevation Profile" to interpolate the sketched polyline onto the raster surface in 3D. Once ready, the view will automatically zoom onto the newly drawn elevation profile. Click "Clear Results" to reset the sample.
- Create a
Rasterfrom a raster dataset, and apply a series ofRasterFunctions to mask any data at or below sea level. - Start the Local Server instance with
LocalServer.Instance.StartAsync(). - Start a
LocalGeoprocessingServiceand create aGeoprocessingTask.- Instantiate
LocalGeoprocessingService(Url, ServiceType)to create a local geoprocessing service. - Invoke
LocalGeoprocessingService.StartAsync()to start the service asynchronously. - Instantiate
GeoprocessingTask.CreateAsync(LocalGeoprocessingService.Url + "/CreateElevationProfileModel")to create a geoprocessing task that uses the elevation profile tool.
- Instantiate
- Create an instance of
GeoprocessingParametersand get its list of inputs withGeoprocessingParameters.Inputs. - Add
GeoprocessingFeatureswith aFeatureCollectionTablepointing to a polyline geometry, andGeoprocessingStringwith a path to the raster data on disk to the list of inputs. - Create and start a
GeoprocessingJobusing the input parameters.- Create a geoprocessing job with
GeoprocessingTask.CreateJob(GeoprocessingParameters). - Start the job with
GeoprocessingJob.Start().
- Create a geoprocessing job with
- Add generated elevation profile as a
FeatureLayerto the scene.- Get the url from the local geoprocessing service using
LocalGeoprocessingService.Url. - Get the server job id of the geoprocessing job using
GeoprocessingJob.ServerJobId. - Replace
GPServerfrom the url withMapServer/jobs/jobId, to get generate elevation profile data. - Create a
ServiceGeodatabasefrom the derived url and create aFeatureLayerfrom the firstFeatureTable. - Set the surface placement mode and add a renderer to the feature layer, then add the new layer to the scene's list of operational layers.
- Get the url from the local geoprocessing service using
- GeoprocessingFeatures
- GeoprocessingJob
- GeoprocessingParameter
- GeoprocessingParameters
- GeoprocessingTask
- LocalGeoprocessingService
- LocalGeoprocessingService.ServiceType
- LocalServer
- LocalServerStatus
- Raster
- RasterFunction
This sample loads with a 10m resolution digital terrain elevation model of the Island of Arran, Scotland (data Copyright Scottish Government and Sepa 2014).
Three raster functions (json format) are applied to the raster data to mask out data at or below sea level.
The geoprocessing task is started with a gpkx. This Create elevation profile geoprocessing package was authored in ArcGIS Pro using ModelBuilder, and the Interpolate Shape (3D Analyst) tool.
ArcGIS Maps SDK for Local Server is deprecated. The last release of Local Server will be ArcGIS Maps SDK for Local Server 200.8. For more information, see the deprecation announcement.
The Package Result tool in ArcGIS Pro is used to author ArcGIS Maps SDK for Native Apps compatible geoprocessing packages (.gpkx files). For more information on running powerful offline geoprocessing tasks to provide advanced spatial analysis to your applications, see ArcGIS Local Server SDK.
The results of the geoprocessing tasks executed with Local Server can be accessed with code, persisted, and shared, for example as a feature collection portal item. This contrasts with the Scene visibility analyses, viewshed and line of sight, which are calculated dynamically at render-time and are displayed only in analysis overlays.
elevation profile, geoprocessing, interpolate shape, local server, offline, parameters, processing, raster, raster function, scene, service, terrain
