Select to view content in your preferred language

Feature Layer not displaying on map. "Unable to perform query. Please check your parameters."

2582
11
07-30-2019 07:59 AM
by Anonymous User
Not applicable

I published a Feature Layer using the arcgis Python API with a custom definition, but I am not able to query it. When I put this layer on the map I keep getting 400 errors, saying "Unable to perform query. Please check your parameters.", which is not very helpful. I figured out the error goes away when I remove the 'geometry' part of the query and I get back all the results. But that doesn't help me display it on a map. 

Is there something possibly wrong with my definition when I create the service, or something else?

0 Kudos
11 Replies
DerrickWong
Esri Contributor

Hi Swakeert Jain‌,

There could be a couple of reasons,

  • Coordinates may be flipped
  • Invalid extent
  • Invalid coordinate system

Can you share your code snippet and your custom definition so that I can have a look at it?

Regards,

Derrick

0 Kudos
by Anonymous User
Not applicable

Hi Derrick Wong‌,

Thank you for your response. Here is a link to a sample Feature Layer I created. (If you go to this codepen and monitor the network calls when moving around the map, all of them return 400)

On creating the Feature Service, I am not giving any extra parameters and letting it use the defaults. For the Feature Layer, I am sending the following definition. Other than the drawing info, I am not trying to set anything in particular:

{'layers': [{'id': 0,

   'name': 'My Geography',

   'parentLayerId': -1,

   'defaultVisibility': True,

   'geometryType': 'esriGeometryPolygon',

   'drawingInfo': {'renderer': {'type': 'uniqueValue',

     'authoringInfo': {'fields': ['F2017_DB_KEY_1',

       'F2017_DB_KEY_2',

       'F2017_DB_KEY_3',

       'F2017_DB_KEY_4'],

      'type': 'predominance',

      'visualVariables': [{'maxSliderValue': 100,

        'minSliderValue': 0,

        'type': 'transparencyInfo'}]},

     'visualVariables': [{'type': 'sizeInfo',

       'target': 'outline',

       'expression': 'view.scale',

       'valueExpression': '$view.scale',

       'stops': [{'size': 1.5, 'value': 873619},

        {'size': 0.75, 'value': 2730060},

        {'size': 0.375, 'value': 10920241},

        {'size': 0, 'value': 21840483}]}],

     'valueExpression': '$feature["F2017_DB_KEY_1"];\n$feature["F2017_DB_KEY_2"];\n$feature["F2017_DB_KEY_3"];\n$feature["F2017_DB_KEY_4"];\nvar fieldNames = ["F2017_DB_KEY_1", "F2017_DB_KEY_2", "F2017_DB_KEY_3", "F2017_DB_KEY_4"];\nvar numFields = 4;\nvar maxValueField = null;\nvar maxValue = -Infinity;\nvar value, i, totalValue = null;\nfor(i = 0; i < numFields; i++) {\nvalue = $feature[fieldNames];\nif(value > 0) {\nif(value > maxValue) {\nmaxValue = value;\nmaxValueField = fieldNames;\n}\nelse if (value == maxValue) {\nmaxValueField = null;\n}\n}\n}\nreturn maxValueField;\n',

     'valueExpressionTitle': 'Predominant Category',

     'uniqueValueInfos': [{'value': 'F2017_DB_KEY_1',

       'label': '2017 DataBase Key 1',

       'symbol': {'color': [175, 0, 110],

        'outline': {'color': [255, 255, 255],

         'width': 1,

         'type': 'esriSLS',

         'style': 'esriSLSSolid'},

        'type': 'esriSFS',

        'style': 'esriSFSSolid'}},

      {'value': 'F2017_DB_KEY_2',

       'label': '2017 DataBase Key 2',

       'symbol': {'color': [21, 195, 218],

        'outline': {'color': [255, 255, 255],

         'width': 1,

         'type': 'esriSLS',

         'style': 'esriSLSSolid'},

        'type': 'esriSFS',

        'style': 'esriSFSSolid'}},

      {'value': 'F2017_DB_KEY_3',

       'label': '2017 DataBase Key 3',

       'symbol': {'color': [253, 185, 19],

        'outline': {'color': [255, 255, 255],

         'width': 1,

         'type': 'esriSLS',

         'style': 'esriSLSSolid'},

        'type': 'esriSFS',

        'style': 'esriSFSSolid'}},

      {'value': 'F2017_DB_KEY_4',

       'label': '2017 DataBase Key 4',

       'symbol': {'color': [94, 39, 81],

        'outline': {'color': [255, 255, 255],

         'width': 1,

         'type': 'esriSLS',

         'style': 'esriSLSSolid'},

        'type': 'esriSFS',

        'style': 'esriSFSSolid'}}]},

    'transparency': 9},

   'fields': [{'name': 'ObjectId',

     'type': 'esriFieldTypeOID',

     'actualType': 'int',

     'alias': '',

     'sqlType': 'sqlTypeInteger',

     'nullable': False,

     'editable': False,

     'domain': None,

     'defaultValue': None},

    {'name': 'F2016_DB_KEY_1',

     'alias': '2016 DataBase Key 1',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2017_DB_KEY_1',

     'alias': '2017 DataBase Key 1',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2016_DB_KEY_2',

     'alias': '2016 DataBase Key 2',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2017_DB_KEY_2',

     'alias': '2017 DataBase Key 2',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2016_DB_KEY_3',

     'alias': '2016 DataBase Key 3',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2017_DB_KEY_3',

     'alias': '2017 DataBase Key 3',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2016_DB_KEY_4',

     'alias': '2016 DataBase Key 4',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2017_DB_KEY_4',

     'alias': '2017 DataBase Key 4',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2016_DB_EXTRA_1',

     'alias': '2016 DataBase Extra 1',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2017_DB_EXTRA_1',

     'alias': '2017 DataBase Extra 1',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2016_DB_EXTRA_2',

     'alias': '2016 DataBase Extra 2',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'},

    {'name': 'F2017_DB_EXTRA_2',

     'alias': '2017 DataBase Extra 2',

     'type': 'esriFieldTypeSingle',

     'actualType': 'real',

     'sqlType': 'sqlTypeReal'}],

   'indexes': [{'name': 'pk',

     'fields': 'ObjectId',

     'isAscending': True,

     'isUnique': True,

     'description': 'clustered, unique, primary key'}],

   'objectIdField': 'ObjectId',

   'uniqueIdField': {'name': 'ObjectId', 'isSystemMaintained': True}}]}

0 Kudos
DerrickWong
Esri Contributor

Hi Swakeert Jain‌,

The Feature Service you have linked do not contain any features. Codepen is returning 200 for all the queries.

0 Kudos
by Anonymous User
Not applicable

Hi Derrick Wong,

Thanks for looking into it. 
The HTTP code says 200, but if you open the response it says error: {code: 400, message: "", details: ["Unable to perform query. Please check your parameters."]}.
Also, if you open the console it shows the error. 

0 Kudos
DerrickWong
Esri Contributor

Swakeert Jain‌, if you query it via the REST endpoint,  it returns 0 results.

The drawing info parameter looks suspect too:

It appears that the substitution did not work and there are quite a few escape characters present:

    {\nvalue = $feature[fieldNames];\nif(value \u003e 0) {\nif(value \u003e maxValue) {\nmaxValue = value;\nmaxValueField = fieldNames;\n}\nelse if (value == maxValue) {\nmaxValueField = null;\n}\n}\n}\nreturn maxValueField;\n","valueExpressionTitle":"Predominant Category","uniqueValueInfos":[{"value":"F2017_DB_KEY_1","label":"2017 DataBase Key 1","symbol":{"color":[175,0,110],"outline":{"color":
0 Kudos
DerrickWong
Esri Contributor

hmm, i had a look at your other layer which drew fine, similar syntax. 

I would try fixing the result count first.

0 Kudos
by Anonymous User
Not applicable

Hi,

Yes the drawing info works fine when viewing on the Acrgis online map viewer. I can't figure out why there is error related to the query. 

This is the query it runs by default in the codepen (change format form pbf to html) and it gives back the error. If I remove the geometry from the parameters, then there is no error. This is the part I am struggling with.

How do you suggest I try to debug this problem?

Many Thanks,
Swakeert

0 Kudos
DerrickWong
Esri Contributor

Swakeert Jain

I tried adding your layer to a blank map on AGOL and then hit the zoom to. It broke the map; my pan and zoom stopped working. This leads me to think that the extent for the layer is incorrect?

Can you check if this is the extent specified is correct?

I don't have access to desktop/pro atm, so I can't check those points.

0 Kudos
by Anonymous User
Not applicable

So, I figured out, the errors also go away when I change the Result Type to standard instead of tile. And if I add this layer as an Item, it works, but only a small set of features. If I upload my entire dataset (~2000 data points), then it stops displaying it. Is this something to do with Arcgis Online credit limits, or is there something technically wrong in something that I am doing?

Many Thanks,

Swakeert

0 Kudos