Styling the map layers using azure-maps-control NPM package

Ashleigh Sims 0 Reputation points
2024-03-21T09:27:47.99+00:00

Hello,

So I'm using the azure-maps-control NPM package. I've ran into an issue where I'm trying to change the colour of all the land and all of the water. I've achieved this in the CDN version but not able to in the NPM package. The documentation is not clear, I can't see functions which I used in the CDN version.

Is this a possibility to do in the NPM package?

Thanks,

Ashleigh

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
653 questions
{count} votes

1 answer

Sort by: Most helpful
  1. rbrundritt 16,456 Reputation points Microsoft Employee
    2024-03-21T14:57:13.09+00:00

    If you are using TypeScript via NPM, you won't see the map.map or the setPaintLayer function as those are undocumented features. The Azure Maps Web SDK wraps MapLibre and creates a more developer friendly APi interface for faster development of common scenarios. map.map is a reference to the wrapped MapLibre instance. TypeScript will not like you trying to access this, so you will need to add a comment above the code to ignore typescript's error. For example:

    //@ts-ignore
    map.map.setPaintProperty(layers[i].id, "fill-color", "#04015A");