Web Scene Drawing Difficulties

233
3
Jump to solution
11-05-2019 12:31 PM
MichaelDenholtz
New Contributor II

I'm using the ArcGIS javascript API to develop a web application that involves querying oceanographic data from within a region. One requirement is to be able to select a region by drawing it on a Web Scene or entering lats and lons in a form. There should be 2-way binding between the polygon on the scene and the form. I was mostly able to achieve this by watching events emitted by a SketchViewModel to update the form when someone sketches, and adding graphics to a graphics layer when someone enters information into the form. Unfortunately, this fails whenever someone attempts to draw or enter a region that crosses the 180th meridian (see Sketch in 3D example).

I previously asked if there was a workaround or fix for drawing across the 180th meridian with the sketch tool and was told that this is a bug with no current workaround. However, the AreaMeasurement3DViewModel is able to draw across the 180th meridian without any issues, so there's some way to do it. I'm having a hard time identifying what that is.

Any ideas for this problem?

0 Kudos
1 Solution

Accepted Solutions
RalucaNicola1
Esri Contributor
0 Kudos
3 Replies
JohnGrayson
Esri Regular Contributor

You should report this to Tech Support so it gets logged into the system to get fixed.  if the requirements are met, try using the normalizeUtils and see if it helps with this issue.

0 Kudos
MichaelDenholtz
New Contributor II

Thanks for the reply. If you mean I should report the sketch widget issue I was told there's already an issue open in this thread: https://community.esri.com/thread/241160-drawing-graphics-in-3d-scene-over-180th-meridian.

I'm a little confused by normalizeUtils. I copied the example from your link almost exactly and it's resolving to a geometry with the exact same non-normalized paths. Code below.

        const polyline = new Polyline({
            paths: [
                [14052.68],
                [22049.5]
            ]
        });

        const cruiseTrajectorySymbol = {
            type: 'line-3d',
            symbolLayers: [{
                type: 'line',
                material: { color: [25512801] },
                cap:  'round',
                join: 'round',
                size: 2
            }]
        }
        let a = this;
       normalizeUtils.normalizeCentralMeridian([polyline])
            .then(function(polylines){
                console.log(polylines);
                // this promise seems to be resolving to the exact same Polyline I put into it
                // 0:
                    // cache: (...)
                    // extent: (...)
                    // hasM: (...)
                    // hasZ: (...)
                    // paths: Array(1)
                        // 0: Array(2)
                            // 0: (2) [140, 52.68]
                            // 1: (2) [220, 49.5]
                const graphic = new esriModules.Graphic({
                    geometry: polylines[0],
                    symbol: cruiseTrajectorySymbol
                });
                a.regionLayer.add(graphic);
        })
0 Kudos
RalucaNicola1
Esri Contributor
0 Kudos