OpenstreetMap as default baselayer

1. A concise explanation of the problem you’re experiencing.

Hi I am building an application where i want the OSM as the default base layer instead of the bing Maps is there a way to do so. I have tried adding the code as mentioned as shown below

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

var osm = new Cesium.OpenStreetMapImageryProvider({
    url : 'https://a.tile.openstreetmap.org/'
});

But it throws an error

“Uncaught TypeError: Cesium.OpenStreetMapImageryProvider is not a constructor”

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Because of the reason i have to visualize the data every time a small change happens and i am nearly at the limit of 1000 bing sessions. Secondly i am doing this for my MS so i cant buy the cesium ion upgraded version

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

I am using cesium 1.6

basically instead of using

var osm = new Cesium.OpenStreetMapImageryProvider({
    url : '[https://a.tile.openstreetmap.org/](https://a.tile.openstreetmap.org/)'
});

You have to use

var osm = new Cesium.createOpenStreetMapImageryProvider({
    url : '[https://a.tile.openstreetmap.org/](https://a.tile.openstreetmap.org/)'
});

Please edit the documentation so that it reflects this the link for the documentation is as follows

https://cesiumjs.org/Cesium/Build/Documentation/createOpenStreetMapImageryProvider.html?classFilter=ImageryProvider

Thanks for catching that! That code example is generated from the source code, which you could fork and submit a pull request to fix:

That would definitely be a useful contribution! See the contributing guide for how to submit a pull request: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md#opening-a-pull-request

I am using:

var osm = new Cesium.createOpenStreetMapImageryProvider({
        url : '[https://a.tile.openstreetmap.org/](https://a.tile.openstreetmap.org/)'
      });
      this.viewer.imagerLayers.addImageryProvider(osm)

I am still getting the following error:

ERROR TypeError: Cesium.createOpenStreetMapImageryProvider is not a constructor

Hi @Aakanksha_Mantri, welcome to the community!

The name of the constructor for OpenStreetMap imagery has changed. See this note from CHANGES.md:

  • createTileMapServiceImageryProvider and createOpenStreetMapImageryProvider have been removed. Instead, pass the same options to new TileMapServiceImageryProvider and new OpenStreetMapImageryProvider respectively. The old functions have been deprecated since 1.62. #8174