Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught RangeError: out of range source coordinates for DEM data, new in 2.4.0 #10927

Open
jaybo opened this issue Aug 12, 2021 · 14 comments
Open
Assignees
Labels
bug 🐞 needs investigation 🔍 Issues that require further research (e.g. it's not clear whether it's GL JS or something else)

Comments

@jaybo
Copy link

jaybo commented Aug 12, 2021

mapbox-gl-js version: 2.4.0

browser: Chrome 92.0.4515.131, also happens on Edge and Safari

Steps to Trigger Behavior

  1. Switch from 2D to 3D map view.
  2. Attempt to edit an existing route using Mapbox Draw.
  3. A stream of "Uncaught RangeError: out of range source coordinates for DEM data" are thrown preventing editing the route, and sometimes even moving the map.

Link to Demonstration

  1. Got to www.deepzoom.com (use desktop, not mobile device)
  2. Select the "Kayak Cordova" demo.
  3. Let the demo run for a moment, then click the stop animation button. Click the "Exit Demos" button.
  4. Go to the "Route" tab. Click the "Edit" button. A stream of the following errors will appear:
Uncaught RangeError: out of range source coordinates for DEM data
    at dh._idx (vendor.5a8c0eaf.js:19)
    at dh.get (vendor.5a8c0eaf.js:19)
    at wh.getElevationAt (vendor.5a8c0eaf.js:19)
    at circle.queryIntersectsFeature (vendor.5a8c0eaf.js:19)
    at vendor.5a8c0eaf.js:19
    at Ah.loadMatchingFeature (vendor.5a8c0eaf.js:19)
    at Ah.query (vendor.5a8c0eaf.js:19)
    at eh.queryRenderedFeatures (vendor.5a8c0eaf.js:19)
    at ke (vendor.5a8c0eaf.js:19)
    at jt.queryRenderedFeatures (vendor.5a8c0eaf.js:19)
    
5. This problem did NOT exist in mapbox gl V2.3.1 or earlier versions.
6. The issue is perhaps related to the steep terrain in this area?  It doesn't seem to trigger as easily in other locations.

Expected Behavior

Actual Behavior

Capture

@jaybo
Copy link
Author

jaybo commented Aug 13, 2021

Perhaps another clue: previously, this same demo script would trigger #10610

@mourner mourner added the needs investigation 🔍 Issues that require further research (e.g. it's not clear whether it's GL JS or something else) label Aug 16, 2021
@jaybo
Copy link
Author

jaybo commented Aug 18, 2021

More information:

  1. This error only happens when 3D is enabled.
  2. This error only happens when a route is either being drawn or displayed using Mapbox Draw.
  3. The problem can happen at any latitude, any zoom, and any topography (including routes strictly defined at sea level).
  4. Still happens in mapbox-gl V2.4.1

@jaybo
Copy link
Author

jaybo commented Aug 18, 2021

Here's a more complete stack trace:
image

@jaybo
Copy link
Author

jaybo commented Aug 18, 2021

Y seems to be out of range:
image

@jaybo
Copy link
Author

jaybo commented Aug 18, 2021

Bingo! I've created a small pen which recreates the issue:
https://codepen.io/jaybonomad/pen/vYmqrRP

Draw a polyline with multiple segments with devtools open.
(The bug is not triggered on every segment or at every location so it may take a few attempts.)

The bug is related to the style applied to linestring vertices using circles with user defined properties.
If I remove the "gl-draw-polygon-and-line-vertex-static" vertex style from this pen, the problem disappears.

@jaybo
Copy link
Author

jaybo commented Aug 18, 2021

Possibly related? mapbox/mapbox-gl-draw#1063

@jaybo
Copy link
Author

jaybo commented Oct 8, 2021

I was able to fix this problem on my end as described below, but the fact that my (apparent?) bug surfaces as a totally unrelated error of "out of range source coordinates for DEM data" was super confusing. And I still have no idea why the change below fixes the exception.

What I changed:

{
    id: "gl-draw-polygon-and-line-vertex-static",
    type: "circle",

     filter: ["all", ["!=", "meta", "midpoint"], ["==", "$type", "Point"]],  // THIS VERSION WORKS
  // filter: ["all", ["!=", "meta", "midpoint"]], // THIS VERSION CAUSES THE DEM EXCEPTION

    paint: {
        "circle-radius": 5,
        "circle-color": ["coalesce", ["get", "user_color"], DZ.dzPerm.activeRouteColor], 
    },
},

I guess this issue can be closed.

@SnailBones SnailBones self-assigned this Jan 5, 2022
@SnailBones
Copy link
Contributor

Thanks for your thorough work looking into this @jaybo! I can confirm that this is still occurring despite the resolution of #10610.

@jaybo
Copy link
Author

jaybo commented Feb 2, 2022

Just a friendly reminder that this is still an issue with 2.7.0. Here's a codepen:
https://codepen.io/jaybonomad/pen/gOXrKqL

Draw a polyline with the map at a 45 degree pitch.

Out comes a steady stream of:

dem_data.js:102 Uncaught RangeError: out of range source coordinates for DEM data
    at Bp._idx (dem_data.js:102:80)
    at Bp.get (dem_data.js:88:28)
    at qp.getElevationAt (elevation.js:251:29)
    at nl (circle_style_layer.js:99:70)
    at circle.queryIntersectsFeature (circle_style_layer.js:64:16)
    at feature_index.js:161:39
    at Np.loadMatchingFeature (feature_index.js:222:56)
    at Np.query (feature_index.js:147:18)
    at bp.queryRenderedFeatures (tile.js:403:40)
    at It (query_features.js:37:43)

@jaybo
Copy link
Author

jaybo commented Apr 14, 2022

I'm guessing the origin of the bug is: mapbox/mapbox-gl-draw#1077

@jaybo
Copy link
Author

jaybo commented Aug 23, 2022

Just a friendly reminder that this is still an issue with mapbox-gl 2.10.0. Here's a codepen:
https://codepen.io/jaybonomad/pen/gOXrKqL

Draw a polyline with the map at a 45 degree pitch. Zoom in and out and rotate the map for maybe a minute. Eventually, out comes a steady stream of:

dem_data.js:102 
        
       Uncaught RangeError: out of range source coordinates for DEM data
    at Ld._idx (dem_data.js:102:80)
    at Ld.get (dem_data.js:88:28)
    at Yd.getElevationAt (elevation.js:288:29)
    at ru (circle_style_layer.js:104:70)
    at circle.queryIntersectsFeature (circle_style_layer.js:66:16)
    at feature_index.js:164:39
    at Wd.loadMatchingFeature (feature_index.js:225:56)
    at Wd.query (feature_index.js:150:18)
    at Id.queryRenderedFeatures (tile.js:440:40)
    at Re (query_features.js:47:43)

@jaybo
Copy link
Author

jaybo commented Feb 9, 2023

Just a friendly reminder that this is still an issue with mapbox-gl 2.12 and mapbox-gl-draw 1.3.0. Here's a codepen:
https://codepen.io/jaybonomad/pen/gOXrKqL

Draw a polyline with the map at a 45 degree pitch. Finish the polyline and then click anywhere except the polyline.

Uncaught RangeError: out of range source coordinates for DEM data
    at Zd._idx (dem_data.js:102:80)
    at Zd.get (dem_data.js:88:28)
    at ay.getElevationAt (elevation.js:315:29)
    at ou (circle_style_layer.js:105:70)
    at circle.queryIntersectsFeature (circle_style_layer.js:67:16)
    at feature_index.js:165:39
    at oy.loadMatchingFeature (feature_index.js:226:56)
    at oy.query (feature_index.js:151:18)
    at Ld.queryRenderedFeatures (tile.js:438:40)
    at Re (query_features.js:47:43)

@stepankuzmin
Copy link
Contributor

Hi @jaybo,

I'm sorry for not getting back to you sooner. I can confirm the issue, and unfortunately, it's still present with the filter modes bugfix applied in GL Draw.

@Quietly-20201113
Copy link

mapbox-gl 3.7.0 mapbox-gl-draw 1.4.3 Not yet resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 needs investigation 🔍 Issues that require further research (e.g. it's not clear whether it's GL JS or something else)
Projects
None yet
Development

No branches or pull requests

5 participants