MapboxImageryProvider format

Hi

i am trying to add MapboxImageryProvider to my viewer

but my url not include ‘format’ :

https://api.mapbox.com/styles/v1/{my_id}/3/3/4?access_token={my_access_token}

when create in cesium with empty string on ‘format’ for example:

https://api.mapbox.com/styles/v1/{my_id}/3/3/4.?access_token={my_access_token}

(how can i create mapBoxImageryProvider with empty ‘fornat’

undefined or null go to default “png”

Thanks

Yair

Hello Yair,

Instead of setting format to the empty string, simply leave it out of the settings you’re passing to the MapBoxImageryProvider. Then Cesium will use png by default.

You can see a code example in the documentation: http://cesiumjs.org/Cesium/Build/Documentation/MapboxImageryProvider.html

Best,

Hannah

but this is my problem i need url with no format :

https://api.mapbox.com/styles/v1/{my_id}/3/3/4?access_token={my_access_token}

בתאריך יום שלישי, 17 בינואר 2017 בשעה 17:41:46 UTC+2, מאת יאיר טוויל:

I’m not sure if that will work. The tiles used on the globe need to be some sort of static image.
But you can try using the UrlTemplateImageryProvider to form the URL.

-Hannah

Hi!

I found a way to do it with proxy on MapboxImageryProvider constructor:

proxy: {
getURL : (url) => {
if(_.isEmpty(layer_obj.format)){
return url.replace(".png", “”);
} else {
return url;
}
}
}

``

But ‘UrlTemplateImageryProvider’ seems more elegant solution

Thanks a lot Hannah!

Yair

בתאריך יום שלישי, 17 בינואר 2017 בשעה 17:41:46 UTC+2, מאת יאיר טוויל: