Using Bing/Azure maps in iTwin viewer #64
Replies: 2 comments 5 replies
-
Hello! Can I ask what was the source of the documentation? We haven't added support for AzureMaps yet, and Bing Maps is deprecated. There is a draft PR up for Azure Maps support, but we haven't prioritized picking it up just yet, because Azure Maps is not feature parity with Bing Maps in terms of map imagery. We are instead however, looking to switch to using google maps: iTwin/itwinjs-core#7414 |
Beta Was this translation helpful? Give feedback.
-
At the moment, you can implement your own MapLayerProvider for AzureMaps - here is a link to our abstract interface for a MapLayerImageryProvider. Upon startup of the Then, assuming you have a viewport created and accessible through your own iTwin viewer, you can do the following to change the map layer imagery for that viewport at any point (perhaps as early in the viewer initialization stage as you can) like so: viewport.displayStyle.attachMapLayer({
settings: ImageMapLayerSettings.fromJSON({name: "PhillyRailLines", formatId: "ArcGIS", url: "https://services7.arcgis.com/nZ2Vb4CUwdo9AIiQ/ArcGIS/rest/services/PhillyRailLines/MapServer"}),
mapLayerIndex: {isOverlay: true, index: 0}
}); The formatId will be the custom formatId you decide for your own imagery provider. You can see how one of our colleagues is implementing a GoogleMaps Provider through this link, and where they set the map layer here (it might be a different approach to setting the map layer, but they still make use of the concept of attaching map layers) |
Beta Was this translation helpful? Give feedback.
-
Hello team,
I am working on creating an iTwin web viewer using iTwin.js and would like to use Bing/Azure base maps in the app. As indicated in the documentation, I have created an Azure Maps account and added the following configuration in the Viewer and the respective key in the .env file, but it isn't working. Am I missing anything here? I would appreciate any help from the community.
mapLayerOptions={{
AzureMaps: {
key: "subscription-key",
value: process.env.IMJS_AZURE_MAP_KEY ?? "",
},
}}
Beta Was this translation helpful? Give feedback.
All reactions