How to run offline geoprocessing tasks in your ArcGIS Runtime application with Local Server

07-07-2022 07:45 AM
Esri Contributor
0 0 326

If you’ve ever wanted to carry out offline geoprocessing tasks in your ArcGIS Runtime applications, or didn’t know that this was possible, then this blog post and associated sample is for you! We have launched a new sample which shows you how to create an elevation profile using a geoprocessing package run with the ArcGIS Runtime Local Server component.

ArcGIS Pro is well known for its library of geoprocessing tools. But did you know you can use a large subset of geoprocessing tools from that library in your own ArcGIS Runtime application, with Local Server (an optional extra component to the ArcGIS Runtime desktop APIs)? We have released a new sample that shows you how to do just that! The sample is currently available for the ArcGIS Runtime SDKs for Java and .NET, with the sample for the ArcGIS Runtime SDK for Qt coming soon. Check them out on the ArcGIS Runtime Samples for Java Github repo, and ArcGIS Runtime Samples for .NET Github repo.


The ArcGIS Runtime Local Server component enables you to run offline geoprocessing tasks within your application to provide advanced spatial analysis and data manipulation, and is available for the ArcGIS Runtime SDKs for Java, .NET, and Qt. We’ve taken the Interpolate Shape geoprocessing tool from ArcGIS Pro, bundled it up into an ArcGIS Runtime compatible geoprocessing package (.gpkx), and used that .gpkx in the sample application using Local Server:


  1. In ArcGIS Pro, use Model Builder to create a custom geoprocessing workflow
  2. Ensure successful execution of the model within ArcGIS Pro
  3. Use the Package Result tool (ensure “Support ArcGIS Runtime” is checked) to package geoprocessing result into a .gpkx file
  4. Create a local geoprocessing service instance from the .gpkx file and run it in your ArcGIS Runtime application using Local Server

The end result: an application that allows you to draw a polyline over a raster and output a 3D elevation profile. In this sample we’ve supplied a raster, a 10m resolution digital terrain model DTM of the Isle of Arran, Scotland (data Copyright Scottish Government and Sepa, 2014), and you can draw the polyline wherever you want to generate the elevation profile. This functionality, for example, could be useful to first responders in a disconnected environment, to help find a route and assess the route terrain when planning access to an emergency over difficult terrain.

We’ve also thrown in a couple of bonuses to this sample: we show you how to apply a raster function workflow (using the ArcGIS Runtime API), which masks the raster to show only values above sea level. We also include custom code that ensures the viewpoint in the application always zooms to face the newly drawn line of section face on, for maximum appreciation of the results.

As with all our sample code, this sample code is licensed under Apache License v 2.0., so feel free to adapt the sample code for use in your own application. You might for example want to use your own DTM or bring in polylines that you’ve produced from tracking a walk/cycle/drive to see your route as an elevation profile in 3D. Or perhaps you have some topographical analysis you’d like to carry out (e.g., valley profile in river/glacial basins), where you’d like to create multiple lines of section and output the results as a diagram or share it as a feature layer to ArcGIS Online.

Try it out and let us know what you think! We have a vast collection of sample code that covers all ranges of our API (sample code is available on all platforms). This collection includes a sample on how to generate contours from a raster, available on Java, Qt, and .NET.

You can also keep an eye out on the ArcGIS Blog for developers page. We’ll be releasing detailed blogs on the workflows involved above, from authoring geoprocessing packages, to running them in an ArcGIS Runtime application and everything in between!

If you don’t want to miss future blog posts, log in and subscribe to this board and check your subscriptions & notifications settings.


We look forward to hearing what other uses you are making or would like to make of the Local Server. Feel free to leave those in the comments.