Select to view content in your preferred language

measure 3d Available ..?

3365
11
Jump to solution
06-22-2016 11:51 PM
JawadhHabeeb1
Deactivated User


Is the measure in 3D Available for JS 4.0 ?

Regards,

Jawadh

Tags (2)
0 Kudos
11 Replies
Jack_Zhang
Frequent Contributor

Hi Thomas, thanks for your reply. that gave me some light. The first method probably won't work for measuring vertical distance, but I'll give a try on the second method you mentioned. appreciated.

0 Kudos
ThomasSolow
Frequent Contributor

Hey Jack, 

I was thinking about this and I realized that there must be a way to transform between ECEF and long/lat/z in the JS API.

Sure enough, the esri/views/3d/externalRenderers module exposes this functionality.  Normally this module is for creating your own scene and placing it in the same rendering pipeline as the main scene, but you should also be able to use it for coordinate conversions to (and from) ECEF.  This functionality is implemented in webGL, which means inputs and outputs are a bit weird: externalRenderers | API Reference | ArcGIS API for JavaScript 4.3 

Coordinates are input as an array like this: [longitude1, latitude1, z1, longitude2, latitude2, z2, ...] for as many points as you like.  The results will be output in an array with [x1, y1, z1, x2, y2, z2, ...] in meters.  You can pass in an empty array and the results be placed in that.  You specify the starting index (in your input array) and how many points you want to transform in the function params.

Here's an example of how you could find the distance between two points with the same long/lat but a different z: JS Bin - Collaborative JavaScript Debugging 

This should work for any two points with long/lat/z (must be wgs84 or web mercator), but keep in mind it's the straight line distance, which isn't always what you want.  There's also going to be some error here, but, in general, I think this should be pretty good.  Also, ECEF is in meters, so the output distance will all be in meters.