11153
January 17, 2017, 3:41pm
1
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
hannah
January 17, 2017, 4:32pm
2
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
11153
January 17, 2017, 4:42pm
3
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, מאת יאיר טוויל:
hannah
January 17, 2017, 6:37pm
4
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
11153
January 18, 2017, 7:08am
5
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, מאת יאיר טוויל: