How to Get Custom Geoprocessing - viewshed analysis

294
3
02-05-2024 08:10 AM
kjtrottier
New Contributor II

Hello,

I am looking at trying to get  this sample code:
https://developers.arcgis.com/javascript/latest/sample-code/geoprocessing-viewshed/
working using our own elevation data.

Whenever we try to publish a GPServer with a viewshed task, like in the sample, using our elevation data it is completely different from what is shown in the sample with different inputs and outputs, and we are unable to get it working.  How am I able to replicate the sample viewshed task with our own data?

Our elevation data is in a .tif with which we have created an ImageServer and published to allow us to use it as a elevation layer inside a scene view, which works as intended.

I've noticed a few other similar posts from a few years ago that remain unanswered.

Any information or alternatives would be great.  The Line of Sight works but is limited to only a few specific points at a time rather than a whole area.

Thank you.

0 Kudos
3 Replies
Noah-Sager
Esri Regular Contributor

Hi @kjtrottier, thanks for posting your question here. It is difficult to determine what the issue is from the JavaScript perspective. Perhaps there is a spatial reference mismatch in the app that is causing the issue? I would recommend reviewing the doc for publishing a GP service:

https://enterprise.arcgis.com/en/server/latest/publish-services/windows/general-considerations-for-u...

or contacting Technical Support for assistance with publishing a GP service for viewshed analysis.

 

0 Kudos
kjtrottier
New Contributor II

Thanks for the Reply Noah, but the issue is that the viewshed tasks are not even remotely similar.

In the sample I supply a point, a distance and get a polygon return which I can then add to the map.

In the viewshed task through our GPServer it is a different set of inputs depending on options I can change but it returns a raster as opposed to the polygons of the example. 

I guess another way to ask is how was the GPurl in the example created, as that is exactly what I need, only with our own data.

If there is better place to ask this question as it extends outside the JavaScript sdk into the server side, let me know, but it is for use inside of JavaScript using the JavaScript sdk example code.

Thank you

0 Kudos
JohnGrayson
Esri Regular Contributor

Not sure if this will still work in Pro as it was authored back in 2011, but I believe this might be what you're looking for: https://www.arcgis.com/home/item.html?id=cede8ab5c0514f41a2cc69bedff67f48

0 Kudos