I am building a custom web app using the ArcGIS JS 4.8 API with an ArcGIS Web service and I have run into an issue.
The root cause that I am trying to fix is to do with features not being filtered out when I perform queries, due to them having duplicate ObjectID values.
I believe this is to do with left-joining non-spatial data to the spatial data since this is a time-based app (in essence, if a road or area requires maintenance every month, this app will have one spatial segment with multiple non-spatial segments, which duplicates the spatial unique ID).
The current table in our production environment looks like this, and when I perform queries on our data I will always see 10001, and 10002, even if I filter it to only show where
| OBJECTID | MAINTENANCEID | MAINTENANCENAME | DATE | |==========|===============|===================|======| | 10001 | 1 | Filter Sand in pit|2017 | | 10001 | 2 | Filter Sand in pit|2018 | | 10002 | 3 | Filter Sand in pit|2019 | | 10002 | 4 | Mow field grass |2018 | | 10003 | 5 | Mow field grass |2019 |
To fix this, I have created an SQL view of my spatial and non-spatial data with a composite unique ID made of the spatial and non-spatial unique id's, which is published through ArcMap as a Web Service. The new column is formatted very similarly to the
NEW_OBJECTID field and is not a stored field but a dynamically generated identity value.
| OBJECTID | MAINTENANCEID | MAINTENANCENAME | DATE | NEW_OBJECTID | |==========|===============|===================|======|==============| | 10001 | 1 | Filter Sand in pit|2017 | 1000101 | | 10001 | 2 | Filter Sand in pit|2018 | 1000102 | | 10002 | 3 | Filter Sand in pit|2019 | 1000203 | | 10002 | 4 | Mow field grass |2018 | 1000204 | | 10003 | 5 | Mow field grass |2019 | 1000305 |
Unfortunately, when I try to display this web service data on a
MapView, I can not see the works using a JS
Inspecting the Web Service through the ArcGIS/rest/services/ online viewer, I can see and query the data. This, however, uses an ArcGIS API 3.25
ArcGISDynamicMapServiceLayer instead of an API 4.8
The front-end code I am using is as simple as I could make it reduce errors, and I have tested it with the current production web service, and it shows correctly.
Any insights on how I could debug or fix this?