0

First time using ArcgisRuntime in C#. I need to be able to query data from hosted feature layers from an internally hosted (enterprise) ArcGIS Portal. I'm using the Tutorial examples on ESRI's dev site. In this first method, I can navigate to the 'PortalItem' instance just fine; the attributes of this instance reflect what I see on the hosted layer page. Great. However, when I attempt to pass it into the FeatureLayer and call LoadAsync(), I get the JSON error:

"Invalid JSON: Range domain ranges only supports int16, int32, float32, float64, and DateTime values"

I also have the ChallengeHandler set, but it doesn't get called. I Suspect this is because the layer is set to 'Everyone'.

            //Getting to the portal seems to work ust fine. ChallengeHandler is never called.
            Uri portalUri = new Uri(@"https://gis.corp.com/portal");
            Task<ArcGISPortal> portalTask = ArcGISPortal.CreateAsync(portalUri, true);
            portalTask.Wait();
            ArcGISPortal portal = portalTask.Result;
            var info = portal.PortalInfo;

            Task<PortalItem> itemTask = PortalItem.CreateAsync(portal, "1fb9cabe45ab4cd28a37066547b40c99"); 
            itemTask.Wait();
            PortalItem knownDevelopmentItem = itemTask.Result; //THIS WORKS - inspecting attributes, they match what I see in the webpage

            FeatureLayer layer = new FeatureLayer(knownDevelopmentItem); //,0);            
            layer.LoadAsync().Wait(); //"Invalid JSON: Range domain ranges only supports int16, int32, float32, float64, and DateTime values"


//Also, just try to load feature table instead - same JSON error
            FeatureTable ft = layer.FeatureTable;
            ft.LoadAsync().Wait(); //"Invalid JSON: Range domain ranges only supports int16, int32, float32, float64, and DateTime values"

Here's the second, more simple attempt that shows the entire URL (which I believe to be accurate, but who knows at this point). Again, LoadAsync() throws the JSON exception.

            //*** Method 2 - just pass in URL *** 
            String knownDevelopmentsURL = @"https://gis.corp.com/hosting/rest/services/Hosted/Known_Developments/FeatureServer/0";
            FeatureLayer layer2 = new FeatureLayer(new Uri(knownDevelopmentsURL));
            layer2.LoadAsync().Wait();

Any ideas on how to fix the JSON error?

EDIT: The entire JSON message is too long to post here, but here's the first bit of it:

{ "currentVersion": 10.81, "cimVersion": "2.6.0", "id": 0, "name": "Known Developments", "type": "Feature Layer", "parentLayer": null, "defaultVisibility": true, "minScale": 0, "maxScale": 0, "canScaleSymbols": false, "geometryType": "esriGeometryPolygon", "description": "", "copyrightText": "", "editFieldsInfo": { "creationDateField": "created_date", "creatorField": "created_user", "editDateField": "last_edited_date", "editorField": "last_edited_user" }, "syncCanReturnChanges": true, "relationships": [], "isDataVersioned": false, "isDataArchived": false, "isDataBranchVersioned": false, "isDataReplicaTracked": false, "isCoGoEnabled": false, "supportsRollbackOnFailureParameter": true, "supportsStatistics": true, "supportsAdvancedQueries": true, "supportsValidateSQL": true, "supportsCoordinatesQuantization": true, "supportsCalculate": true, "supportsASyncCalculate": true, "advancedQueryCapabilities": { "supportsReturningQueryExtent": true, "supportsStatistics": true, "supportsDistinct": true, "supportsPagination": true, "supportsOrderBy": true, "supportsQueryWithDistance": true, "supportsLod": true, "supportsPaginationOnAggregatedQueries": true, "supportsQueryWithResultType": true, "supportsCountDistinct": true, "supportsReturningGeometryCentroid": true, "supportsHavingClause": true, "supportsQueryWithLodSR": true, "supportsTopFeaturesQuery": true, "supportsOrderByOnlyOnLayerFields": false, "supportsPercentileStatistics": true, "supportsQueryAttachments": true, "supportsQueryAttachmentsWithReturnUrl": true, "supportsQueryWithDatumTransformation": true }, "extent": { "xmin": -1.3265363373E7, "ymin": 5839121.877800003, "xmax": -1.2880901900899999E7, "ymax": 6217740.999799997, "spatialReference": { "wkid": 102100, "latestWkid": 3857, "xyTolerance": 0.001, "zTolerance": 0.001, "mTolerance": 0.001, "falseX": -20037700, "falseY": -30241100, "xyUnits": 10000, "falseZ": -100000, "zUnits": 10000, "falseM": -100000, "mUnits": 10000 } },

5
  • Any chance you could share the json returned from gis.corp.com/hosting/rest/services/Hosted/Known_Developments/… Also do not ever use .Wait(). always use "await" instead, or your app will likely deadlock.
    – dotMorten
    Commented May 16, 2022 at 16:26
  • The whole JSON response won't fit in the main post or a comment, but I posted some of it above.
    – ErikJL
    Commented May 16, 2022 at 21:36
  • Also, thanks for the note about avoiding Wait(). I haven't used the async/await construct much but I'll have to learn it since this SDK is 100% all about it.
    – ErikJL
    Commented May 16, 2022 at 21:39
  • Thanks for the json but it is leaving out the crucial parts. For me to investigate I will need the full thing. If you have a github account you can post it on gist.github.com and share the link.
    – dotMorten
    Commented May 16, 2022 at 21:57
  • Try here: github.com/erikjl/GIS
    – ErikJL
    Commented May 16, 2022 at 22:28

1 Answer 1

1

Looking at the JSON service metadata, it defines the range domains as a small integer, but it declares the values as strings. So bottom line the service metadata looks invalid.

4
  • I see that 'load_type' and 'iscomplete' are domains defined as a string, but I'm not seeing where the small integer is being defined. Can you point me to the line number you're looking at?
    – ErikJL
    Commented May 18, 2022 at 16:10
  • Also, how would I go about fixing this?
    – ErikJL
    Commented May 18, 2022 at 16:10
  • Look for the range parameter in the json. Not sure how you'd fix that - Looks like a publishing issue on the hosted service end.
    – dotMorten
    Commented May 19, 2022 at 17:16
  • ArcGIS Pro wouldn't let me remove the whole domain from the field, so I created the new fields and deleted the old. I am no longer seeing the JSON error. Thank you! I'll try to get our admin to submit the bug to ESRI.
    – ErikJL
    Commented May 24, 2022 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.