Creating a City map of locations

Robert Harrett 0 Reputation points
2026-09-19T16:20:36.17+00:00

How do I create a city map with multiple addresses located on it?

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

1 answer

Sort by: Newest
  1. Rukshan edirisinghe 830 Reputation points
    2026-09-19T17:35:38.1433333+00:00

    Hi @Robert Harrett

    It's a two-step job with Azure Maps: convert each address to coordinates (geocoding), then drop those coordinates on a map as pins.

    1. Create an Azure Maps account in the portal and copy your subscription key.
    2. Geocode each address:
    https://atlas.microsoft.com/geocode?api-version=2025-01-01&query=15127 NE 24th Street Redmond WA&subscription-key=YOUR_KEY
    

    The response gives you [longitude, latitude] for each address.

    1. Show them on a map with the Web SDK, one pin per address:
    <link href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.css" rel="stylesheet"/>
    <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.js"></script>
    <div id="myMap" style="height:600px"></div>
    <script>
    var map = new atlas.Map('myMap', {
      center: [-73.985, 40.757],   // your city center [lng, lat]
      zoom: 12,
      authOptions: { authType: 'subscriptionKey', subscriptionKey: 'YOUR_KEY' }
    });
    map.events.add('ready', function () {
      var ds = new atlas.source.DataSource();
      map.sources.add(ds);
      var addresses = [[-73.9857, 40.7577], [-73.968, 40.785]]; // geocoded coords
      addresses.forEach(c => ds.add(new atlas.data.Point(c)));
      map.layers.add(new atlas.layer.SymbolLayer(ds));
    });
    </script>
    

    One tip: if you're not building an app and just want a quick map from a list of addresses, use the Azure Maps visual in Power BI instead. You feed it the address column directly and it geocodes and plots them with zero code.

    References: https://learn.microsoft.com/en-us/rest/api/maps/search/get-geocoding https://learn.microsoft.com/en-us/azure/azure-maps/map-add-pin

    Was this answer helpful?

    0 comments No comments

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.