Javascript query returnZ does not impact the promise response

144
2
Jump to solution
05-10-2020 04:43 AM
ManolisNikolakakis
New Contributor II

Hello! 

I want to create a mouse move query on a PolylineZ feature layer. However I cannot figure out how to return the Z values of the vertices of the mentioned polylines, even though returnZ and returnGeometry of the query are set to true. 

The response of the query does not contain a third (z) value.

I have made an example of the behaviour in the following Codepen piece of code below and along the js lines 51 and 55 is the behaviour that I do not understand how to overcome it. My main goal is to be able to return the xyz value of the nearest vertex to the mouse cursor of the PolylineZ feature, however I can only get the xy values

https://codepen.io/nikolakakis/pen/YzyLryo 

I would appreciate any advice or answer on how to achieve this or what is the problem here.

Thank you!

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

Currently, in 2D MapView we do not fetch z values on the client-side (LayerView geometries do not have the z values) even if you set the FeatureLayer.returnZ to true (which you have to set to true if you want to fetch the z values on the client side). We have an issue for this. In meantime, you can query the layer instead of layerView to get the z values. 

So please change the line 53 in your test code to  layer.queryFeatures(query)... this will make a network request to the service and service will honor your request for z values.

-Undral

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

Currently, in 2D MapView we do not fetch z values on the client-side (LayerView geometries do not have the z values) even if you set the FeatureLayer.returnZ to true (which you have to set to true if you want to fetch the z values on the client side). We have an issue for this. In meantime, you can query the layer instead of layerView to get the z values. 

So please change the line 53 in your test code to  layer.queryFeatures(query)... this will make a network request to the service and service will honor your request for z values.

-Undral

View solution in original post

ManolisNikolakakis
New Contributor II

Thank you Undral!

so close for the solution, however I spent lot of time in the wrong direction. That will do it just fine.

0 Kudos