Request featureservice with f=geojson & callback parameter in onpremise installation

1673
1
04-29-2020 02:02 AM
TobiasWyss
New Contributor

Hi folks

We’re currently working on a webapp based on leaflet 1.6.0 and angular.
To access featureservices served by our onpremise installation of ArcGIS Server 10.7.1 or ArcGIS online, we use esri-leaflet (2.4.0). Esri-leaflet, by default, uses when querying a featurelayer the output format geojson (f=geojson), combined with the parameter `callback` to define a callback function which should be called, once the data arrived at the client. (I was not able to find a documentation about this behaviour, but it is how I think esri-leaflet works, when I’m looking at the request it sends to the ArcGIS server.)


A sample request from esri-leaflet to ArcGIS online looks like this:
https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Hazards_Uptown_Charlotte/FeatureServer/0/query?returnGeometry=true&where=1=1&outFields=*&f=geojson&callback=window._EsriLeafletCallbacks.c23
As you can see, the requested output format is geojson and a callback function is provided. The response’s MIME type is `text/javascript` and the callback function gets returned to the client.
The result looks like

window._EsriLeafletCallbacks.c23({});


Now when I do a similar request with the same parameters `f=geojson` and `callback=window._EsriLeafletCallbacks.c23` to a featureservice served by our onpremise ArcGIS Server, the callback functions gets ignored and the response’s MIME-type is `application/geo+json`. In this case we are not able to display the features on our map, because 1.) the wrong MIME-type is returned and gets blocked, 2.) the callback function gets ignored and is not returned to the client.
With esri-leaflet you have the possibility to set `isModern=false` to make the request with `f=json` instead of `f=geojson`. With this option, everything works fine on our onpremise installation, the response has the correct MIME-type and the callback function gets returend as well.

We were not able to fix this on our ArcGIS Server.

Did anybody observe the same behaviour on their onpremise installation or knows a way how to fix this?

Thanks a lot & kind regards

1 Reply
AndryJoos
Occasional Contributor

A quick update: This was accepted by Esri as a bug: BUG-000130672: Callback function in query request is not working with geojson format.

0 Kudos