TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.16k stars 360 forks source link

ArcGIS feature server dataset causes browser freeze & crash #6840

Open t83714 opened 1 year ago

t83714 commented 1 year ago

ArcGIS feature server dataset causes browser freeze & crash

Related to: #3661

This ArcGIS feature server dataset: https://services1.arcgis.com/gtRkYQyUQLMTM1uS/ArcGIS/rest/services/_Biologically_Important_Areas_of_Regionally_Significant_Marine_Species/FeatureServer/0

Can't be rendered by the latest TerriaJs correctly and will freeze/crash the browser.

However, ArcGIS's own viewer can visualise it well:

https://www.arcgis.com/apps/mapviewer/index.html?url=https://services1.arcgis.com/gtRkYQyUQLMTM1uS/ArcGIS/rest/services/_Biologically_Important_Areas_of_Regionally_Significant_Marine_Species/FeatureServer/0&source=sd

CleanShot 2023-08-13 at 15 13 53@2x

Why?

Terriajs now access the traditional JSON API and request JSON output. e.g. :

https://services1.arcgis.com/gtRkYQyUQLMTM1uS/arcgis/rest/services/_Biologically_Import[…]tFields=*&outSR=4326&resultRecordCount=1000&resultOffset=0

However, the features included in this dataset are not points anymore. They are polygons (can also see from the screenshot). Even one polygon's shape data could be huge (it could cover an area larger than a state)

Our current approach (by limiting no. of features returned) to prevent data to big will not work as even one feature could be too big (without polygon simplification).

Possbile Solution

ArcGIS's own viewer can work because it requests ArcGIS API to return tile rather than JSON (which works similarly to tiles in a tiled map service layer).

One example request (before proper query parameter encoding for ease of reading) could be:

https://services1.arcgis.com/gtRkYQyUQLMTM1uS/arcgis/rest/services/_Biologically_Important_Areas_of_Regionally_Significant_Marine_Species/FeatureServer/0/query?f=pbf&geometry=11271098.442813028,-6261721.357117023,12523442.714237027,-5009377.08569302&maxRecordCountFactor=4&resultOffset=0&resultRecordCount=8000&where=1=1&orderByFields=FID&outFields=FID&quantizationParameters={"extent":{"xmin":11271098.442813028,"ymin":-6261721.357117023,"xmax":12523442.714237027,"ymax":-5009377.08569302},"mode":"view","originPosition":"upperLeft","tolerance":2445.984905125002}&resultType=tile&returnCentroid=true&spatialRel=esriSpatialRelIntersects&geometryType=esriGeometryEnvelope&defaultSR=102100

We have ticket #3661 detailing this approach.

Why we should re-look at implementing #3661

https://hub.arcgis.com/ is getting more popular. Its SaaS model means all their clients running on the latest version.

More and more datasets previously had to serve as map services might be served as ArcGIS feature services, which means we would encounter this issue more often.

t83714 commented 1 year ago

@na9da mentioned it's worth investigating why our GeoJson VT wasn't kicked in for this case