Share via

Using the Azure Maps Gridded Data Source Module in an Angular Application

Ken Bowman 321 Reputation points
2024-07-19T20:54:14.19+00:00

Hi,

I'm looking at transitioning my Angular application which currently uses Bing Maps to an Angular application using Azure Maps. One of the features in my current application uses the Bing Maps Data Binning Module. I was happy to find that there is a solution to do data binning in Azure Maps using the Azure Maps Gridded Data Source module (https://github.com/Azure-Samples/azure-maps-gridded-data-source), but there doesn't appear to be an NPM package that supports it.

I'm wondering how to incorporate this feature into my Angular solution or if anyone has successfully done so in an Angular application.

Thanks in advance for help or information,

Ken

Azure Maps
Azure Maps

An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.

0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Ken Bowman 321 Reputation points
    2024-08-01T21:37:19.3333333+00:00

    Just following up on this. I ended up changing the file extension to .ts, removing the IIFE and treating it as a normal function that I pass a new object to along with the atlas object. Not ideal, but it works.

    Please comment if anyone has been successful with a better way of working with this inside Angular.

    This functionality (i.e., gridded data source/data binning) should really be built into Azure Maps as it provides a great alternative to clustering and heat maps.

    Ken

    0 comments No comments

  2. Ken Bowman 321 Reputation points
    2024-07-26T22:42:27.4333333+00:00

    I've tried half a dozen ways of loading the azure-maps-gridded-data-source JavaScript with no success. Half of the ways loads the script too early (for example when referencing it in angular.json) and the other ways (such as when loading the script dynamically) appear to not find "atlas" and fail with "TypeError: Cannot read properties of undefined (reading 'DataSource')" at line 2004: (azmaps.source.DataSource));

    I'm sure there's something I'm missing, but I'd appreciate any push in the right direction for loading this particular script in Angular.

    Thanks,

    Ken


  3. rbrundritt 21,701 Reputation points
    2024-07-19T21:32:50.3633333+00:00

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.