Search code examples
azure-maps

Is it possible to get azure map tiles from REST without icons?


I am using the Azure Maps Render - Get Map Tile REST Api and was wondering if it would be possible to get the tiles without azure's own icons, since I am mainly using them to display my own.

I am usually displaying them at zoom level 16 so there are a lot of azure's own icons (e.g. traffic stops).

I am pretty sure that it would work with the Web SDK (correct me if I am wrong please), but I really want to use the API. Unfortunately, all the styles offered by azure (microsoft.base) feature the icons.

Thank you in advance for your help :).

public function getMapTile(int $x, int $y, int $zoom): string
    {
        $response = $this->getDataFromAPI('/map/tile', [
            'x' => $x,
            'y' => $y,
            'zoom' => $zoom,
            'tileSize' => 256,
            'tilesetId' => 'microsoft.base.road',
            'api-version' => '2022-08-01',
        ]);

        if (!$response->successful()) {
            throw new Exception('Couldn\'t fetch tile data from azuremaps API');
        }

        return $response->body();
    }

Solution

  • I don't believe any of the static map tiles styles have this option. The vector tiles were meant to allow for custom styling but their schema hasn't been documented as there has been some major shifts in their structure over the past year. If you use the Azure Maps web SDK, it is possible to modify how these are styled using undocumented code and achieve the experience you are looking for, but it doesn't sound like you are. A couple of options:

    • If you have only basic rendering needs, you could use the vector tiles and render them in a custom service using a custom style and a library like https://github.com/AliFlux/VectorTileRenderer But this would be a decent amount of work that could break if the tile schema changes in the future.
    • Consider using Bing Maps. Azure Maps and Bing Maps use the same data. Bing Maps is an older platform, but it's tiles do support custom styling.

    Information on how to directly access Bing Maps tiles: https://learn.microsoft.com/en-us/bingmaps/rest-services/directly-accessing-the-bing-maps-tiles

    Information on custom map styles with Bing Maps: https://learn.microsoft.com/en-us/bingmaps/articles/custom-map-styles-in-bing-maps#custom-map-styles-in-the-rest-and-tile-services