Closed ethansudman closed 1 year ago
Please refer to the following example on how to add a TileLayer.
import {
AzureMap,
AzureMapDataSourceProvider,
AzureMapsProvider,
AzureMapLayerProvider
} from "react-azure-maps";
import { AuthenticationType } from "azure-maps-control";
const option = {
authOptions: {
authType: AuthenticationType.subscriptionKey,
subscriptionKey: ""
},
center: [-73.985708, 40.75773],
zoom: 2
};
export default function MapWithTileLayer() {
return (
<div style={{ height: "300px" }}>
<AzureMapsProvider>
<AzureMap options={option}>
<AzureMapDataSourceProvider id={"TileLayer DataSource "}>
<AzureMapLayerProvider
id={"TileLayer Layer"}
options={{
tileUrl:
"https://{azMapsDomain}/map/tile?api-version=2.0&tilesetId=microsoft.weather.infrared.main&zoom={z}&x={x}&y={y}",
opacity: 0.8,
tileSize: 256
}}
type={"TileLayer"}
/>
</AzureMapDataSourceProvider>
</AzureMap>
</AzureMapsProvider>
</div>
);
}
Related Stack Overflow question is posted here.
When I try to create a Tile Layer like this:
I get the following exception:
Line 44 is
map.layers.add(weatherTileLayer);
by the way.