ArcGisMapServerImageryProvider format doesn't appear to be configurable

72 views
Skip to first unread message

smil...@gmail.com

unread,
Jul 11, 2019, 3:10:59 AM7/11/19
to cesium-dev
1. A concise explanation of the problem you're experiencing.
I need to use an ArcGisMapServerImageryProvider where the format query parameter is png32.

The hard coded format in the code seems to be png. See: https://github.com/AnalyticalGraphicsInc/cesium/blob/1.59/Source/Scene/ArcGisMapServerImageryProvider.js#L265

If I add format to the resource queryParameters it is ignored due to the above code. I would have expected you could override the 'default' queryparam values with queryparams in resource?

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
Try changing the format used here: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=ArcGIS%20MapServer.html

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
The png data for this MapServer (non-public, or I'd link it) is not valid, but the png32 data works perfectly.

4. The Cesium version you're using, your operating system and browser.
1.59

Omar Shehata

unread,
Jul 11, 2019, 10:36:20 AM7/11/19
to cesium-dev
Thanks for reporting this! I can see that there's a call to resource.getDerivedResource (https://cesiumjs.org/Cesium/Build/Documentation/Resource.html?classFilter=Resour#getDerivedResource) which has a "preserveQueryParameters" that defaults to false. I wonder if this should be true instead here.

If that works, it'd be awesome to make a pull request to contribute this to CesiumJS! See the contributing guide here for tips on that https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md#opening-a-pull-request

Scott Mills

unread,
Jul 15, 2019, 10:57:08 PM7/15/19
to cesium-dev
Hi Omar,

Thanks for your response. It doesn't appear that changing preserveQueryParameters between true and false does anything.

Either way, the queryParameters specified in the above linked LOC are merged over the top of the queryParameters in the resource.

If I add '&format=test' to the url string, and add {format: "some_other_value"} to the queryParameters arg on the Resource object, then I end up with an array of both listed for 'format' on the resource as expected.

Once "resource = imageryProvider._resource.getDerivedResource()" is run however, the format arg is replaced with "png" only, regardless of whether preserveQueryParameters is true or false.

It looks like 'preserveQueryParameters' doesn't work properly if queryParameters are passed through to the getDerivedResource() function, unless I'm missing something...

Could this be an issue with preserveQueryParameters?

Kind Regards,
Scott

--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/dmP6FRtGoMY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cesium-dev/2893cec8-bb43-4502-ac8e-7d150efcae10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Omar Shehata

unread,
Jul 19, 2019, 3:20:12 PM7/19/19
to cesium-dev
I think I see what you mean here. The preserve parameter seems to only work as expected if the query parameters are in the URL, and not when it's passed as a queryParameters object. So this code example works as expected I think:

var viewer = new Cesium.Viewer('cesiumContainer');

var resource = new Cesium.Resource({
    url: 'https://example.com',
    queryParameters: {'key': 'value'}
});

var derivedResource = resource.getDerivedResource({
    preserveQueryParameters: true
});

console.log(resource.url);//https://example.com?key=value
console.log(derivedResource.url);//https://example.com?key=newValue&key=value


You can see the derived resource has the original value at the end of the list. As opposed to this example where it is replaced:

var viewer = new Cesium.Viewer('cesiumContainer');

var resource = new Cesium.Resource({
    url: 'https://example.com',
    queryParameters: {'key': 'value'}
});

var derivedResource = resource.getDerivedResource({
    url: 'https://example.com',
    queryParameters: {'key': 'newValue'},
    preserveQueryParameters: true
});

console.log(resource.url);//https://example.com?key=value
console.log(derivedResource.url);//https://example.com?key=newValue


So we'd need to fix both this bug, and then set `preserveQueryParameters` to true in the ArcGIS imagery provider. To confirm that would fix this issue you could set preserve to true and add the format parameter to the url in the getDerivedResource call.
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages