Esri/esri-leaflet

FeatureLayer: initial tiles are requested concurrently with metadata

markhepburn opened this issue · 2 comments

Describe the bug

FeatureLayers now checks for geojson support, by issuing a metadata query and checking supportedQueryFormats. See #773 and #418 for history.

However, this is done concurrently with the initial set of tiles (FeatureGrid._update()), so the first tiles received are still in arcgis format and must be converted to geojson, which can easily choke the browser on large layers.

See #1372 for a partial fix, which calls _update at the end of the metadata callback, rather than asynchronously. It's only partial because _update is triggered in a few places, so probably needs some way of checking if metadata has loaded yet.

(This all assumes of course that isModern has not been manually set, which forces geojson).

Reproduction

  • Monitor browser's network requests for requests to your esri server
  • Open https://jsbin.com/weduvomeku/1/edit
  • Check the f= parameter in the esri tile requests -- may be slightly deterministic, but expect to see f=json
  • Zoom in, to load more tiles
  • Check the f= parameter again, which this time should be f=geojson

Logs

No response

System Info

Leaflet version: v1.9.0
esri-leaflet version v3.0.11

  System:
    OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
    Memory: 8.90 GB / 15.36 GB
    Container: Yes
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 20.3.1 - ~/.asdf/installs/nodejs/20.3.1/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 9.6.7 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 117.0.5938.92

Additional Information

No response

Hi @markhepburn I've looked into this issue and would like to work on a fix. Is anyone else already addressing this, or can I proceed?

@alhridoy thanks!

(And I forgot to mention, but this also affects the esri-leaflet-renderers, so initial polygons are often unstyled).