Distances differ when measured in different projection systems. It is for sure. Bu what I am currently facing seems to me kind of a bug.
A simple model that uses the Point Distance tool.. Finds out the settlements within 10km distance of a point.. The version on the left uses a parameter which allows locating the input point when the model is run. The one on the right uses the point feature within the layer and executes the model without an input point parameter.
When the model on the left is run, the very same point is located and the model is executed. Results are of course the same in ArcGIS Desktop.
The projection system of layers are UTM Z38N and varying frame projections confirmed to have no effect on the result. All results match manual measurements in UTM.
Both models are then published as a geoprocessing service and this time run from ArcGIS Server again in ArcGIS Desktop environment. Results are still the same.
Then the geoprocessing services are added as WAB widgets to a web application in Portal for ArcGIS. While the model on the right continues to give the same result, the one on the left starts to calculate distances in Web Mercator causing 20% to 30% differences.
I know the maps in the portal use Web Mercator but;
1) Why the projection of the map effects the model on the left but not on the right? Same model, same layers.
2) Why the projection of the data frame does no effect on any of these models in ArcGIS Desktop?
If the explanation is "the projection comes from the map when the input is a parameter but comes from the layer when the input is not a parameter but this is only the case in Portal for ArcGIS but not ArcGIS Desktop(with a Web Mercator projection)" then this is definitely a bug.
The projection of the data frame projects the layer on the fly just for viewing. But the data of the layer remains unchanged. So it has no effect on the result.
If you use the geoprocessing service in WAB and draw point on the map, the spatial reference of the point is Web Mercator. You can use GeometryService to project it to the proper spatial reference before send to the geoprocessing service.
Thank you Jian. At least now I am in the correct path to solve the problem. And probably this tool will help me to solve a few more issues.
Since I am not familiar with the geometry service, I need some tips to move on. I have been reading the resources and issues related to the geometry service and understood what it does. But I am still not clear on "how to use" part.
I found the REST Services Directory and thought I could make an adjustment in "Project" which will then take the points entered to the map and project it before sending to a widget. But seemingly it works a bit differently. It was easy to set the WKID of Web Mercator as Input and that of UTM Z38N to Output but got stuck on the "Geometries". In the examples I found specific coordinates are entered to this part but as my tool will use a random point entered on the map I have no idea how to fill "Geometries".
The services directory may not be the right point to begin with since there are several examples where geometry service is used within Python codes. So I may need to put a similar piece of script after exporting my model to Python code.
The ArcGIS help pages explains the function of the geometry service very well but does not show how to use it that good.
I would really appreciate if you could give me some tips.