orderByFields with geometry query parameters

268
0
03-16-2020 12:06 PM
Alexander__Contractor_Schrimpf
New Contributor

Hi,

For some reason I am unable to sort query results using the orderByFields parameter when I also pass data in the geometry query parameter. I have tried on multiple different service layers (both arcgis online and hosted internally).
Testing it here it works correctly however:

https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0/query?where=1%3D1&text=&...

These two query strings give the exact same results:

query?where=1%3D1&objectIds=&time=&geometry=%7B"spatialReference"%3A%7B"wkid"%3A102100%7D%2C"xmin"%3A-10726864.061925028%2C"ymin"%3A4927441.778913066%2C"xmax"%3A-10560537.088376528%2C"ymax"%3A5074200.873220565%7D&geometryType=esriGeometryEnvelope&inSR=102100&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Meter&returnGeodetic=false&outFields=*&returnHiddenFields=false&returnGeometry=true&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&orderByFields=OBJECTID+ASC&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=0&resultRecordCount=10&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=html

query?where=1%3D1&objectIds=&time=&geometry=%7B"spatialReference"%3A%7B"wkid"%3A102100%7D%2C"xmin"%3A-10726864.061925028%2C"ymin"%3A4927441.778913066%2C"xmax"%3A-10560537.088376528%2C"ymax"%3A5074200.873220565%7D&geometryType=esriGeometryEnvelope&inSR=102100&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Meter&returnGeodetic=false&outFields=*&returnHiddenFields=false&returnGeometry=true&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&orderByFields=OBJECTID+DESC&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=0&resultRecordCount=10&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=html

When I remove the geometry query parameter sorting works exactly as expected

query?where=1%3D1&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=102100&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Meter&returnGeodetic=false&outFields=*&returnHiddenFields=false&returnGeometry=true&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&orderByFields=OBJECTID+DESC&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=0&resultRecordCount=10&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=html


Here is my layer information:

{
  "currentVersion" : 10.7, 
  "id" : 0, 
  "name" : "HydroAddressPointswithQC2500RandomV7", 
  "type" : "Feature Layer", 
  "serviceItemId" : "0b6195a200bf49a1b47abd75f900addd", 
  "displayField" : "HydroAddressID", 
  "description" : "", 
  "copyrightText" : "", 
  "defaultVisibility" : true, 
  "editingInfo" : {
    "lastEditDate" : 1584369476377
  }, 
  "relationships" : [], 
  "isDataVersioned" : false, 
  "supportsAppend" : true, 
  "supportsCalculate" : true, 
  "supportsASyncCalculate" : true, 
  "supportsTruncate" : true, 
  "supportsAttachmentsByUploadId" : true, 
  "supportsAttachmentsResizing" : true, 
  "supportsRollbackOnFailureParameter" : true, 
  "supportsStatistics" : true, 
  "supportsExceedsLimitStatistics" : true, 
  "supportsAdvancedQueries" : true, 
  "supportsValidateSql" : true, 
  "supportsCoordinatesQuantization" : true, 
  "supportsFieldDescriptionProperty" : true, 
  "supportsQuantizationEditMode" : true, 
  "supportsApplyEditsWithGlobalIds" : false, 
  "supportsReturningQueryGeometry" : true, 
  "advancedQueryCapabilities" : {
    "supportsPagination" : true, 
    "supportsPaginationOnAggregatedQueries" : true, 
    "supportsQueryRelatedPagination" : true, 
    "supportsQueryWithDistance" : true, 
    "supportsReturningQueryExtent" : true, 
    "supportsStatistics" : true, 
    "supportsOrderBy" : true, 
    "supportsDistinct" : true, 
    "supportsQueryWithResultType" : true, 
    "supportsSqlExpression" : true, 
    "supportsAdvancedQueryRelated" : true, 
    "supportsCountDistinct" : true, 
    "supportsPercentileStatistics" : true, 
    "supportsLod" : true, 
    "supportsQueryWithLodSR" : false, 
    "supportedLodTypes" : [
      "geohash"
    ], 
    "supportsReturningGeometryCentroid" : false, 
    "supportsQueryWithDatumTransformation" : true, 
    "supportsHavingClause" : true, 
    "supportsOutFieldSQLExpression" : true, 
    "supportsMaxRecordCountFactor" : true, 
    "supportsTopFeaturesQuery" : true, 
    "supportsDisjointSpatialRel" : true, 
    "supportsQueryWithCacheHint" : true
  }, 
  "useStandardizedQueries" : true, 
  "geometryType" : "esriGeometryPoint", 
  "minScale" : 0, 
  "maxScale" : 0, 
  "extent" : {
    "xmin" : -177.10755675532565, 
    "ymin" : 13.256663054422972, 
    "xmax" : 145.92024380577055, 
    "ymax" : 71.019395373096984, 
    "spatialReference" : {
      "wkid" : 4269, 
      "latestWkid" : 4269
    }
  }, 
  "drawingInfo":{"renderer":{"type":"simple","symbol":{"type":"esriSMS","style":"esriSMSCircle","color":[0,115,76,255],"size":10,"angle":0,"xoffset":0,"yoffset":0,"outline":{"color":[0,0,0,255],"width":0}}},"scaleSymbols":true,"transparency":0,"labelingInfo":null}, 
  "allowGeometryUpdates" : true, 
  "hasAttachments" : false, 
  "htmlPopupType" : "esriServerHTMLPopupTypeAsHTMLText", 
  "hasMetadata" : true, 
  "hasM" : false, 
  "hasZ" : true, 
  "enableZDefaults" : true, 
  "zDefault" : 0, 
  "objectIdField" : "OBJECTID", 
  "uniqueIdField" : 
  {
    "name" : "OBJECTID", 
    "isSystemMaintained" : true
  }, 
  "globalIdField" : "", 
  "typeIdField" : "", 
  "fields" : [
    {
      "name" : "OBJECTID", 
      "type" : "esriFieldTypeOID", 
      "alias" : "OBJECTID", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : false, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "HydroAddressID", 
      "type" : "esriFieldTypeString", 
      "alias" : "HydroAddressID", 
      "sqlType" : "sqlTypeOther", 
      "length" : 40, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "AddressDate", 
      "type" : "esriFieldTypeDate", 
      "alias" : "AddressDate", 
      "sqlType" : "sqlTypeOther", 
      "length" : 8, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "FeatureType", 
      "type" : "esriFieldTypeString", 
      "alias" : "FeatureType", 
      "sqlType" : "sqlTypeOther", 
      "length" : 60, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "OnNetwork", 
      "type" : "esriFieldTypeInteger", 
      "alias" : "OnNetwork", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : true, 
      "domain" : 
      {
        "type" : "codedValue", 
        "name" : "NoYesDomain", 
        "codedValues" : [
          {
            "name" : "No", 
            "code" : 0
          }, 
          {
            "name" : "Yes", 
            "code" : 1
          }
        ]
      }, 
      "defaultValue" : null
    }, 
    {
      "name" : "SourceID", 
      "type" : "esriFieldTypeString", 
      "alias" : "SourceID", 
      "sqlType" : "sqlTypeOther", 
      "length" : 130, 
      "nullable" : false, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "SourceAgency", 
      "type" : "esriFieldTypeString", 
      "alias" : "SourceAgency", 
      "sqlType" : "sqlTypeOther", 
      "length" : 130, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "SourceDataset", 
      "type" : "esriFieldTypeString", 
      "alias" : "SourceDataset", 
      "sqlType" : "sqlTypeOther", 
      "length" : 130, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "SourceFeatureURL", 
      "type" : "esriFieldTypeString", 
      "alias" : "SourceFeatureURL", 
      "sqlType" : "sqlTypeOther", 
      "length" : 255, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "Catchment", 
      "type" : "esriFieldTypeDouble", 
      "alias" : "Catchment", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "HU", 
      "type" : "esriFieldTypeString", 
      "alias" : "HU", 
      "sqlType" : "sqlTypeOther", 
      "length" : 16, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "ReachCode", 
      "type" : "esriFieldTypeString", 
      "alias" : "ReachCode", 
      "sqlType" : "sqlTypeOther", 
      "length" : 14, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "Measure", 
      "type" : "esriFieldTypeDouble", 
      "alias" : "Measure", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "ReachSMDate", 
      "type" : "esriFieldTypeDate", 
      "alias" : "ReachSMDate", 
      "sqlType" : "sqlTypeOther", 
      "length" : 8, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "OriginalReachCode", 
      "type" : "esriFieldTypeString", 
      "alias" : "OriginalReachCode", 
      "sqlType" : "sqlTypeOther", 
      "length" : 14, 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "OriginalMeasure", 
      "type" : "esriFieldTypeDouble", 
      "alias" : "OriginalMeasure", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : true, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "OriginalRCMatch", 
      "type" : "esriFieldTypeInteger", 
      "alias" : "OriginalRCMatch", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : true, 
      "editable" : true, 
      "domain" : 
      {
        "type" : "codedValue", 
        "name" : "NoYesDomain", 
        "codedValues" : [
          {
            "name" : "No", 
            "code" : 0
          }, 
          {
            "name" : "Yes", 
            "code" : 1
          }
        ]
      }, 
      "defaultValue" : null
    }, 
    {
      "name" : "SnapTolerance", 
      "type" : "esriFieldTypeDouble", 
      "alias" : "SnapTolerance", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "SnapDistance", 
      "type" : "esriFieldTypeDouble", 
      "alias" : "SnapDistance", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "InSnapTolerance", 
      "type" : "esriFieldTypeInteger", 
      "alias" : "InSnapTolerance", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : true, 
      "domain" : 
      {
        "type" : "codedValue", 
        "name" : "NoYesDomain", 
        "codedValues" : [
          {
            "name" : "No", 
            "code" : 0
          }, 
          {
            "name" : "Yes", 
            "code" : 1
          }
        ]
      }, 
      "defaultValue" : null
    }, 
    {
      "name" : "QCTolerance", 
      "type" : "esriFieldTypeDouble", 
      "alias" : "QCTolerance", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : true, 
      "domain" : null, 
      "defaultValue" : null
    }, 
    {
      "name" : "InQCTolerance", 
      "type" : "esriFieldTypeInteger", 
      "alias" : "InQCTolerance", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : true, 
      "domain" : 
      {
        "type" : "codedValue", 
        "name" : "NoYesDomain", 
        "codedValues" : [
          {
            "name" : "No", 
            "code" : 0
          }, 
          {
            "name" : "Yes", 
            "code" : 1
          }
        ]
      }, 
      "defaultValue" : null
    }, 
    {
      "name" : "QCApproved", 
      "type" : "esriFieldTypeInteger", 
      "alias" : "QCApproved", 
      "sqlType" : "sqlTypeOther", 
      "nullable" : false, 
      "editable" : true, 
      "domain" : 
      {
        "type" : "codedValue", 
        "name" : "NoYesDomain", 
        "codedValues" : [
          {
            "name" : "No", 
            "code" : 0
          }, 
          {
            "name" : "Yes", 
            "code" : 1
          }
        ]
      }, 
      "defaultValue" : null
    }
  ], 
  "indexes" : [
    {
      "name" : "PK__HYDROADD__F4B70D856D3291D3", 
      "fields" : "OBJECTID", 
      "isAscending" : true, 
      "isUnique" : true, 
      "description" : ""
    }, 
    {
      "name" : "user_3341.HYDROADDQC_HYDROADDRESSPOINTSWITHQC2500RANDOMV7_Shape_sidx", 
      "fields" : "Shape", 
      "isAscending" : true, 
      "isUnique" : false, 
      "description" : ""
    }
  ], 
  "types" : [], 
  "templates" : [
    {
      "name" : "HydroAddressPointswithQC2500RandomV7", 
      "description" : "", 
      "drawingTool" : "esriFeatureEditToolPoint", 
      "prototype" : {
        "attributes" : {
          "InQCTolerance" : 0, 
          "QCApproved" : 0, 
          "HydroAddressID" : null, 
          "AddressDate" : null, 
          "FeatureType" : null, 
          "OnNetwork" : 0, 
          "SourceID" : " ", 
          "SourceAgency" : null, 
          "SourceDataset" : null, 
          "SourceFeatureURL" : null, 
          "Catchment" : null, 
          "HU" : null, 
          "ReachCode" : null, 
          "Measure" : null, 
          "ReachSMDate" : null, 
          "OriginalReachCode" : null, 
          "OriginalMeasure" : null, 
          "OriginalRCMatch" : null, 
          "SnapTolerance" : 0, 
          "SnapDistance" : 0, 
          "InSnapTolerance" : 0, 
          "QCTolerance" : 0
        }
      }
    }
  ], 
  "supportedQueryFormats" : "JSON, geoJSON, PBF", 
  "hasStaticData" : false, 
  "maxRecordCount" : 2000, 
  "standardMaxRecordCount" : 32000, 
  "standardMaxRecordCountNoGeometry" : 32000, 
  "tileMaxRecordCount" : 8000, 
  "maxRecordCountFactor" : 1, 
  "capabilities" : "Query"
}j
Tags (1)
0 Kudos
0 Replies