Code Monkey home page Code Monkey logo

azuremapscodesamples's Introduction

Azure Maps Code Samples

A collection of over a hundred code samples for the Azure Maps Web SDK.

Try it now

screenshot

Related Projects

Additional Resources

Contributing

We welcome contributions. Feel free to submit code samples, file issues and pull requests on the repo and we'll address them as we can. Learn more about how you can help on our Contribution Rules & Guidelines.

You can reach out to us anytime with questions and suggestions using our communities below:

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

MIT

See License for full license text.

azuremapscodesamples's People

Contributors

andykao1213 avatar artixz avatar asergaz avatar beigebadger avatar clintondow-ms avatar cschotte avatar jugi92 avatar kartben avatar microsoftopensource avatar msftgits avatar outinyman avatar perfahlen avatar rbrundritt avatar stevemunk avatar supernova-eng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azuremapscodesamples's Issues

Drawing Line Color?

Is it possible to add the ability to select the line color to the toolbar? So for example, I want to use lines to draw 4 or 5 shapes, can I change the line color for each shape?

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please conenct with the Azure support team at https://azure.com/support or report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with the official Azure Maps documentation you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Subscription Key Security Strategy

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Run up the AzureMapsCodeSamples project as-is, no modification required.

Any log messages given by the failure

N/A

Expected/desired behavior

Thanks for this great demo pack. A quick question around the subscripton key.

I am experimenting with using the Map class for a few of our projects, my basic instantiation looks as follows:

new atlas.Map(this.id, {
            "subscription-key": subscriptionKey,
            language: "en-US",
            zoom: this.zoom
            ... more optional params
        }); 

By my understanding, the class requires that the subscription key be provided on instantiation, it will then be held by the class and used for subsequent requests to the API that provides data for the map (tile vectors, traffic incidents etc.) This obviously means that the subscription key must be brought out into client-side JS in order to be supplied to the class.

What I would like is to be able to provide a proxy url for the Map component, which will be able to intercept requests to its API, and insert the subscription key directly from the server.

Hopefully someone can provide a bit of clarity and if I have missed something obvious in the docs!

Thanks

OS and Version?

Windows 10

icons not showing until zoomed in

  • [x ] bug report -> please search issues before submitting
  • feature request
  • [x ] documentation issue or request
  • regression (a behavior that used to work and stopped in a new release)

When you have a map that has multiple points it only renders some of the icons and then the missing ones will show when you start to zoom in??

We are using the standard example for points in a route

var sPoint = new atlas.data.Feature(new atlas.data.Point([dataHere]), {
      title: 'Im the title ',
        icon: 'pin-blue',
        allowOverlap: 1
    });

2019-03-07 at 7 47 pm

2019-03-07 at 7 48 pm

Azure Map Weather Preview - Get Hourly Forecast API - HourlyForecast date property issue

This issue is for a: (mark with an x)

- [x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Iā€™m calling Azure Map Weather - Get Hourly Forecast API, using C# back-end in ASP.NET Core 3.1.4 application.
As {query} Iā€™m passing different LAT/LON coordinates from around the world and retrieve their forecasts, samples below :

New York
https://atlas.microsoft.com/weather/forecast/hourly/json?api-version=1.0&query=40.742942509622026,-73.99119584365023&subscription-key=..&duration=24&unit=metric

Tokyo
https://atlas.microsoft.com/weather/forecast/hourly/json?api-version=1.0&query=35.679017035406105,139.75276947021487&subscription-key=..&duration=24&unit=metric

Iā€™m retrieving the correct forecast for location.
For different locations, I would expect to retrieve HourlyForecast date property in ISO 8601
format that contains time offset of the location I'm requesting.

Instead, the time offset is the same for all locations. Details below :

New York
New York

Tokyo
Tokyo

Berlin
Berlin

Please let me know if you can reproduce this or I'm doing something wrong here ?

OS, Browser and Version?

Windows 10, VS 2019 Version 16.7.7, ASP.NET Core 3.1.4

Azure Map Control JavaScript - ERR_NAME_NOT_RESOLVED

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with "official Azure Maps documentation** you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

open the HTML in my chrome browser.

Any log messages given by the failure

GET https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css net::ERR_NAME_NOT_RESOLVED

image

Expected/desired behavior

Hello team, I'd like to check if the sample is working properly or not.
I can't reach out or add references from URL below.

   <!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
   <link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css" />
   <script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>

OS, Browser and Version?

Windows 10
Edge, Chrome

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Documented list of expressions

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ x ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Expected/desired behavior

A list of operators and their input/output for use in expressions.

Map, search tab,center marker and geolocation are perfect, but location markers are not displayed

//The maximum zoom level to cluster data point data on the map.
var maxClusterZoomLevel = 11;

//The URL to the store location data.
var storeLocationDataUrl = 'data/ContosoCoffee.txt';

//The URL to the icon image. 
var iconImageUrl = 'images/CoffeeIcon.png';

//An array of country region ISO2 values to limit searches to.
var countrySet = ['US', 'CA', 'GB', 'FR','DE','IT','ES','NL','DK' ,'IN'];      

var map, popup, datasource, iconLayer, centerMarker, searchURL;
var listItemTemplate = '<div class="listItem" onclick="itemSelected(\'{id}\')"><div class="listItem-title">{title}</div>{city}<br />Open until {closes}<br />{distance} miles away</div>';

function initialize() {
    //Initialize a map instance.
    map = new atlas.Map('myMap', {
        center: [-90, 40],
        zoom: 2,
        view: 'Auto',

                //Add authentication details for connecting to Azure Maps.
                authOptions: {
                    //Alternatively, use an Azure Maps key. Get an Azure Maps key at https://azure.com/maps. NOTE: The primary key should be used as the key.
                    authType: 'subscriptionKey',
                    subscriptionKey: '<key>'
                }
    });

    //Create a popup but leave it closed so we can update it and display it later.
    popup = new atlas.Popup();

    //Use MapControlCredential to share authentication between a map control and the service module.
    var pipeline = atlas.service.MapsURL.newPipeline(new atlas.service.MapControlCredential(map));

    //Create an instance of the SearchURL client.
    searchURL = new atlas.service.SearchURL(pipeline);

    //If the user presses the search button, geocode the value they passed in.
    document.getElementById('searchBtn').onclick = performSearch;

    //If the user presses enter in the search textbox, perform a search.
    document.getElementById('searchTbx').onkeyup = function (e) {
        if (e.keyCode === 13) {
            performSearch();
        }
    };

    //If the user presses the My Location button, use the geolocation API to get the users location and center/zoom the map to that location.
    document.getElementById('myLocationBtn').onclick = setMapToUserLocation;

    //Wait until the map resources are ready.
    map.events.add('ready', function () {
        //Add the zoom control to the map.
        map.controls.add(new atlas.control.ZoomControl(), {
            position: 'top-right'
        });

        //Add an HTML marker to the map to indicate the center used for searching.
        centerMarker = new atlas.HtmlMarker({
            htmlContent: '<div class="mapCenterIcon"></div>',
            position: map.getCamera().center
        });

        map.markers.add(centerMarker);

        //Create a data source and add it to the map and enable clustering.
        datasource = new atlas.source.DataSource(null, {
            cluster: true,
            clusterMaxZoom: maxClusterZoomLevel - 1
        });

        map.sources.add(datasource);

        //Load all the store data now that the data source has been defined. 
        loadStoreData();

        //Create a bubble layer for rendering clustered data points.
        var clusterBubbleLayer = new atlas.layer.BubbleLayer(datasource, null, {
            radius: 12,
            color: '#2d00aa',
            strokeColor: 'white',
            strokeWidth: 2,
            filter: ['has', 'point_count'] //Only render data points which have a point_count property, which clusters do.
        });

        //Create a symbol layer to render the count of locations in a cluster.
        var clusterLabelLayer = new atlas.layer.SymbolLayer(datasource, null, {
            iconOptions: {
                image: 'none' //Hide the icon image.
            },
            textOptions: {
                textField: ['get', 'point_count_abbreviated'],
                size: 12,
                font: ['StandardFont-Bold'],
                offset: [0, 0.4],
                color: 'white'
            }
        });

        map.layers.add([clusterBubbleLayer, clusterLabelLayer]);

        //Load a custom image icon into the map resources.
        map.imageSprite.add('myCustomIcon', iconImageUrl).then(function () {

            //Create a layer to render a coffe cup symbol above each bubble for an individual location.
            iconLayer = new atlas.layer.SymbolLayer(datasource, null, {
                iconOptions: {
                    //Pass in the id of the custom icon that was loaded into the map resources.
                    image: 'myCustomIcon',

                    //Optionally scale the size of the icon.
                    font: ['SegoeUi-Bold'],

                    //Anchor the center of the icon image to the coordinate.
                    anchor: 'center',

                    //Allow the icons to overlap.
                    allowOverlap: true
                },
                filter: ['!', ['has', 'point_count']] //Filter out clustered points from this layer.
            });

            map.layers.add(iconLayer);

            //When the mouse is over the cluster and icon layers, change the cursor to be a pointer.
            map.events.add('mouseover', [clusterBubbleLayer, iconLayer], function () {
                map.getCanvasContainer().style.cursor = 'pointer';
            });

            //When the mouse leaves the item on the cluster and icon layers, change the cursor back to the default which is grab.
            map.events.add('mouseout', [clusterBubbleLayer, iconLayer], function () {
                map.getCanvasContainer().style.cursor = 'grab';
            });

            //Add a click event to the cluster layer. When someone clicks on a cluster, zoom into it by 2 levels. 
            map.events.add('click', clusterBubbleLayer, function (e) {
                map.setCamera({
                    center: e.position,
                    zoom: map.getCamera().zoom + 2
                });
            });

            //Add a click event to the icon layer and show the shape that was clicked.
            map.events.add('click', iconLayer, function (e) {
                showPopup(e.shapes[0]);
            });

            //Add an event to monitor when the map has finished moving.
            map.events.add('render', function () {
                //Give the map a chance to move and render data before updating the list.
                updateListItems();
            });
        });
    });
}

function loadStoreData() {
    //Download the store location data.
    fetch(storeLocationDataUrl)
        .then(response => response.text())
        .then(function (text) {

            //Parse the Tab delimited file data into GeoJSON features.
            var features = [];

            //Split the lines of the file.
            var lines = text.split('\n');

            //Grab the header row.
            var row = lines[0].split('\t');

            //Parse the header row and index each column, so that when our code for parsing each row is easier to follow.
            var header = {};
            var numColumns = row.length;
            var i;

            for (i = 0; i < row.length; i++) {
                header[row[i]] = i;
            }

            //Skip the header row and then parse each row into a GeoJSON feature.
            for (i = 1; i < lines.length; i++) {
                row = lines[i].split('\t');

                //Ensure that the row has the right number of columns.
                if (row.length >= numColumns) {

                    features.push(new atlas.data.Feature(new atlas.data.Point([parseFloat(row[header['Longitude']]), parseFloat(row[header['Latitude']])]), {
                        AddressLine: row[header['AddressLine']],
                        City: row[header['City']],
                        Municipality: row[header['Municipality']],
                        AdminDivision: row[header['AdminDivision']],
                        Country: row[header['Country']],
                        PostCode: row[header['PostCode']],
                        Phone: row[header['Phone']],
                        StoreType: row[header['StoreType']],
                        IsWiFiHotSpot: (row[header['IsWiFiHotSpot']].toLowerCase() === 'true') ? true : false,
                        IsWheelchairAccessible: (row[header['IsWheelchairAccessible']].toLowerCase() === 'true') ? true : false,
                        Opens: parseInt(row[header['Opens']]),
                        Closes: parseInt(row[header['Closes']])
                    }));
                }
            }

            //Add the features to the data source.
            datasource.add(features);

            //Initially update the list items.
            updateListItems();
        });
}

function performSearch() {
    var query = document.getElementById('searchTbx').value;

    //Perform a fuzzy search on the users query.
    searchURL.searchFuzzy(atlas.service.Aborter.timeout(3000), query, {
        //Pass in the array of country ISO2 for which we want to limit the search to.
        countrySet: countrySet,
        view: 'Auto'
    }).then(results => {
        //Parse the response into GeoJSON so that the map can understand.
        var data = results.geojson.getFeatures();

        if (data.features.length > 0) {
            //Set the camera to the bounds of the results.
            map.setCamera({
                bounds: data.features[0].bbox,
                padding: 40
            });
        } else {
            document.getElementById('listPanel').innerHTML = '<div class="statusMessage">Unable to find the location you searched for.</div>';
        } 
    });
}

function setMapToUserLocation() {
    //Request the user's location.
    navigator.geolocation.getCurrentPosition(function (position) {
        //Convert the geolocation API position into a longitude/latitude position value the map can understand and center the map over it.
        map.setCamera({
            center: [position.coords.longitude, position.coords.latitude],
            zoom: maxClusterZoomLevel + 1
        });
    }, function (error) {
        //If an error occurs when trying to access the users position information, display an error message.
        switch (error.code) {
            case error.PERMISSION_DENIED:
                alert('User denied the request for Geolocation.');
                break;
            case error.POSITION_UNAVAILABLE:
                alert('Position information is unavailable.');
                break;
            case error.TIMEOUT:
                alert('The request to get user position timed out.');
                break;
            case error.UNKNOWN_ERROR:
                alert('An unknown error occurred.');
                break;
        }
    });
}

function updateListItems() {
    //Hide the center marker.
    centerMarker.setOptions({
        visible: false
    });

    //Get the current camera/view information for the map.
    var camera = map.getCamera();

    var listPanel = document.getElementById('listPanel');

    //Check to see if the user is zoomed out a lot. If they are, tell them to zoom in closer, perform a search or press the My Location button.
    if (camera.zoom < maxClusterZoomLevel) {
        //Close the popup as clusters may be displayed on the map. 
        popup.close();

        listPanel.innerHTML = '<div class="statusMessage">Search for a location, zoom the map, or press the "My Location" button to see individual locations.</div>';
    } else {
        //Update the location of the centerMarker.
        centerMarker.setOptions({
            position: camera.center,
            visible: true
        });

        //List the ten closest locations in the side panel.
        var html = [], properties;

        /*
            Generating HTML for each item that looks like this:
         
            <div class="listItem" onclick="itemSelected('id')">
                <div class="listItem-title">1 Microsoft Way</div>
                Redmond, WA 98052<br />
                Open until 9:00 PM<br />
                0.7 miles away
            </div>
         */

        //Get all the shapes that have been rendered in the bubble layer. 
        var data = map.layers.getRenderedShapes(map.getCamera().bounds, [iconLayer]);

        //Create an index of the distances of each shape.
        var distances = {};

        data.forEach(function (shape) {
            if (shape instanceof atlas.Shape) {

                //Calculate the distance from the center of the map to each shape and store in the index. Round to 2 decimals.
                distances[shape.getId()] = Math.round(atlas.math.getDistanceTo(camera.center, shape.getCoordinates(), 'miles') * 100) / 100;
            }
        });

        //Sort the data by distance.
        data.sort(function (x, y) {
            return distances[x.getId()] - distances[y.getId()];
        });

        data.forEach(function (shape) {
            properties = shape.getProperties();

            html.push('<div class="listItem" onclick="itemSelected(\'', shape.getId(), '\')"><div class="listItem-title">',
                properties['AddressLine'],
                '</div>',

                //Get a formatted address line 2 value that consists of City, Municipality, AdminDivision, and PostCode.
                getAddressLine2(properties),
                '<br />',

                //Convert the closing time into a nicely formated time.
                getOpenTillTime(properties),
                '<br />',

                //Get the distance of the shape.
                distances[shape.getId()],
                ' miles away</div>');
        });
        
        listPanel.innerHTML = html.join('');

        //Scroll to the top of the list panel incase the user has scrolled down.
        listPanel.scrollTop = 0;
    }
}

//This converts a time in 2400 format into an AM/PM time or noon/midnight string.
function getOpenTillTime(properties) {
    var time = properties['Closes'];
    var t = time / 100;

    var sTime;

    if (time === 1200) {
        sTime = 'noon';
    } else if (time === 0 || time === 2400) {
        sTime = 'midnight';
    } else {
        sTime = Math.round(t) + ':';

        //Get the minutes.
        t = (t - Math.round(t)) * 100;

        if (t === 0) {
            sTime += '00';
        } else if (t < 10) {
            sTime += '0' + t;
        } else {
            sTime += Math.round(t);
        }

        if (time < 1200) {
            sTime += ' AM';
        } else {
            sTime += ' PM';
        }
    }

    return 'Open until ' + sTime;
}

//When a user clicks on a result in the side panel, look up the shape by its id value and show popup.
function itemSelected(id) {
    //Get the shape from the data source using it's id. 
    var shape = datasource.getShapeById(id);
    showPopup(shape);

    //Center the map over the shape on the map.
    var center = shape.getCoordinates();
    var offset;

    //If the map is less than 700 pixels wide, then the layout is set for small screens.
    if (map.getCanvas().width < 700) {
        //When the map is small, offset the center of the map relative to the shape so that there is room for the popup to appear.
        offset = [0, -80];
    }

    map.setCamera({
        center: center,
        centerOffset: offset
    });
}

function showPopup(shape) {
    var properties = shape.getProperties();

    /*
        Generating HTML for the popup that looks like this:
         <div class="storePopup">
                <div class="popupTitle">
                    3159 Tongass Avenue
                    <div class="popupSubTitle">Ketchikan, AK 99901</div>
                </div>
                <div class="popupContent">
                    Open until 22:00 PM<br/>
                    <img title="Phone Icon" src="images/PhoneIcon.png">
                    <a href="tel:1-800-XXX-XXXX">1-800-XXX-XXXX</a>
                    <br>Amenities:
                    <img title="Wi-Fi Hotspot" src="images/WiFiIcon.png">
                    <img title="Wheelchair Accessible" src="images/WheelChair-small.png">
                </div>
            </div>
     */

    //Calculate the distance from the center of the map to the shape in miles, round to 2 decimals.
    var distance = Math.round(atlas.math.getDistanceTo(map.getCamera().center, shape.getCoordinates(), 'miles') * 100)/100;

    var html = ['<div class="storePopup">'];

    html.push('<div class="popupTitle">',
        properties['AddressLine'],
        '<div class="popupSubTitle">',
        getAddressLine2(properties),
        '</div></div><div class="popupContent">',

        //Convert the closing time into a nicely formated time.
        getOpenTillTime(properties),

        //Add the distance information.  
        '<br/>', distance,
        ' miles away',
        '<br /><img src="images/PhoneIcon.png" title="Phone Icon"/><a href="tel:',
        properties['Phone'],
        '">', 
        properties['Phone'],
        '</a>'
    );

    if (properties['IsWiFiHotSpot'] || properties['IsWheelchairAccessible']) {
        html.push('<br/>Amenities: ');

        if (properties['IsWiFiHotSpot']) {
            html.push('<img src="images/WiFiIcon.png" title="Wi-Fi Hotspot"/>');
        }

        if (properties['IsWheelchairAccessible']) {
            html.push('<img src="images/WheelChair-small.png" title="Wheelchair Accessible"/>');
        }
    }

    html.push('</div></div>');

    //Update the content and position of the popup for the specified shape information.
    popup.setOptions({
        //Create a table from the properties in the feature.
        content:  html.join(''),
        position: shape.getCoordinates()
    });

    //Open the popup.
    popup.open(map);
}

//Creates an addressLine2 string consisting of City, Municipality, AdminDivision, and PostCode.
function getAddressLine2(properties) {
    var html = [properties['City']];

    if (properties['Municipality']) {
        html.push(', ', properties['Municipality']);
    }

    if (properties['AdminDivision']) {
        html.push(', ', properties['AdminDivision']);
    }

    if (properties['PostCode']) {
        html.push(' ', properties['PostCode']);
    }

    return html.join('');
}

//Initialize the application when the page is loaded.
window.onload = initialize;

Unable to execute Azure Map code samples in VS2017

I cloned Azure map code sample from here (https://github.com/Azure-Samples/AzureMapsCodeSamples) . Executed .sln file using Microsoft Visual studio 2017. But unfortunately unable to build the code as is. So googled errors occurred during execution. Tried some solution by installing node.js and installing npm azure-maps-control . Still getting following error.
Error code: TS2307 (TS) Cannot find module 'azure-maps-control'.

I am not getting at this moment, am I doing it in incorrect way or any other issue might be there?

Can we execute single module instead of loading complete project into VS. It might be helpful for me.

Demo not working

Following tutorial at:
https://docs.microsoft.com/en-us/azure/azure-maps/quick-demo-map-app

Added Maps Account to Azure, got primary key.

The tutorial recommends; "Search for the string . Replace it with the Primary Key value from the preceding section."

Said string doesn't exist, but there was a different "<>" that looked like the same thing. Put Primary Key there, saved html and opened in Chrome.

Nothing. Just an empty search box and no map.

--edit--
Oh. Not available in Korea. Glad I went to all that work. I guess it's off to Google for me :(

Cannot build solution from fresh repo clone

This issue is for a: (mark with an x)

- [X] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Clone repo, open solution, press F5 to build. Build error:

Severity Code Description Project File Line Suppression State
Error Build:File 'C:/data/git/AzureMapsCodeSamples/AzureMapsCodeSamples/Common/typings/azure-maps-control.d.ts' not found. AzureMapsCodeSamples C:\data\git\AzureMapsCodeSamples\AzureMapsCodeSamples\Experimental\Solar Terminator Module\SolarTerminatorModule.ts 25

This file is not part of the repo, but is mentioned in the csproj.

Expected/desired behavior

Build out of the box

OS, Browser and Version?

Windows 10 (2004)
Edge

Unable to get speed while animating on a route

I need to animate along a line and want to display heading and speed.
I am able to get heading but getting undefined when I try to get speed.
image

So far I have tried as below. Any help would be appreciated.

this.maper.imageSprite.createFromTemplate('arrow-icon', 'marker-arrow', 'black', '#fff').then(() => {
      this.arrowIconForAnimation = new atlas.layer.SymbolLayer(pinSource, null, {
        iconOptions: {
          image: 'arrow-icon',
          anchor: 'center',
          rotation: ['+', 180, ['get', 'heading']],
          rotationAlignment: 'map',
          ignorePlacement: true,
          allowOverlap: true
        },
        textOptions: {
          ignorePlacement: true,
          allowOverlap: true
        }
      });
      this.maper.layers.add(this.arrowIconForAnimation);
      const pin = new atlas.Shape(new atlas.data.Feature(new atlas.data.Point(EndLocation)));
      pinSource.add(pin);

      this._configs.animation = new atlas.animations.moveAlongPath(line, pin, {
        captureMetadata: true,
        duration: 6000,
        map: this.maper,
        zoom: 15,
        rotate: true
      });
      this._configs.animation.properties = {
        speed: speed
      }
      this.setSpeed("0.1");
      this.maper.events.add("onprogress", this._configs.animation, (e) => {
        Object.keys(e).forEach(key => {
          if (key === 'heading') {
            console.log(e[key]);
          }
            console.log(e.speed); //undefined
        });
      });
    })

How to add a background color to white instead of color: 'orange' - ?

I am developing a live-track application and i am displaying the name of the particular pinpoint on top. I don't wanna change the color but i want to change the background-color. My goal is to get the required output as seen in the following image : -
image .
How to get my required output ?

So far i have tried -
textOptions: {
textField: [
'format',
['get', 'title'],
{}
],
size: 14,
backgroundColor: "white",
offset: [0, -2.7]
},

But this is making no change in look and feel. I have gone through this link - https://docs.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.textoptions?view=azure-maps-typescript-latest but no property of no help regarding my issue.

How to set background-color in these ?

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with "official Azure Maps documentation** you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

browser can't find `atlas.microsoft.com`

This issue is for a: (mark with an x)

- [x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

i clone .html file from https://github.com/Azure-Samples/AzureMapsCodeSamples/blob/master/AzureMapsCodeSamples/Tutorials/interactiveSearch.html. but it doesn't work.

Also, I fill my azure map's key value to authOptions.subscriptionKey following https://docs.microsoft.com/en-us/azure/azure-maps/quick-demo-map-app this document. but it still doesn't work.

this issue look like it can't find atlas.microsoft.com
I think like this things below are causing problems.

<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.css" type="text/css">
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>

Any log messages given by the failure

atlas.min.css:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
atlas.min.js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
atlas-service.min.js:1 Failed to load resource: net::ERR_NAME_NOT_RESOLVED
demo.html:33 Uncaught ReferenceError: atlas is not defined
    at GetMap (demo.html:33)
    at onload (demo.html:351)

Expected/desired behavior

Can you tell me another CDN or if you have another solution?

OS, Browser and Version?

Windows 10. Mac OS.
Edge,Safari

For the Draw Polygon Sample, is it possible to draw multiple polygons and then save the drawing?

Hi:

I need to draw multiple shapes on the map, can that be done?
Is it possible to save the map with the drawn shapes? If not, does the SDK provide a way to get the Lat/Long and/or GPS for the points used to draw the Polygon? That would be a possible way to save a drawing...

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please conenct with the Azure support team at https://azure.com/support or report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with the official Azure Maps documentation you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report
- [X] feature request
- [X ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Azure Maps Control - JavaScript - How do I find the nearest marker

Situation:
I have the Azure Maps SDK showing the map-based UX. I have overlaid the map using HtmlMarker objects using custom data. At any point of time, there would be one or more HtmlMarker objects on the map.

What I need to be able to do:
The user clicks on a map-provided POI (let's say a Starbucks outlet). Now for that POI, I have a custom HtmlMarker (usually quite near the map's own POI). Based on the user's click on the POI, I need to find my HtmlMarker for that same POI.

Documentation:
As per the Azure Maps SDK documentation, there is supposed to be a HtmlMarkerManager. Here is the link.

There is no documentation on how one can use this HtmlMarkerManager interface or where to find it at runtime.

The best I am able to do is do a map.markers.markers -- this is shown as being a Set object in the runtime JavaScript inspector (browser's F12 tools). But it does not seem to support any mechanism of iterating through it, though the inspector shows its size to be 1 (correct).

Help appreciated.

Sample showing how state boundaries can be visible when zoomed out

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Expected/desired behavior

Provide an example demonstrating how the US state boundaries can be visisble at a zoomed out level - this context information can be beneficial in certain use cases

OS, Broswer and Version?

OS X
Chrome

Mention any other details that might be useful


Thanks! We'll be in touch soon.

"as explained in the readme.md. There is significant benefit which is outlined in the the readme"

We read the following comment In: "common/TokenService.ashx.cs"

For the Web SDK to authorize correctly, you still must assign Azure role based access control for the managed identity as explained in the readme.md. There is significant benefit which is outlined in the the readme.
The readme file does not have any explanation on how to set this up.
What Readme file are we referring to here ?

How to enable place labels to make the map more useful ?

Currently there are only road names shown on our mapping screens in Azure Maps.

image

I'd like to enable place labels to make the map more useful, see example from google maps:

image

How to get this required output like as google maps ? Any help would be appreciated.

Hello Ricky I found some issues in documentin https://docs.microsoft.com/en-nz/azure/azure-maps/quick-demo-map-app in the secion that refer to your code they ask to replace the susbcription key, but hte code is inactive ( commented). Also as a newbie to AzureMap, I want replace my AAD client id but still it didnot run, just show me a blan page with MS Lo at the end and search botton, could oyu please help to run the sample, So I can learn from it , Thanks Leila

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please conenct with the Azure support team at https://azure.com/support or report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with the official Azure Maps documentation you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Indoor Map not loading on Safari

Ensure this is the right place

Ensure this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please connenct with the Azure support team at https://azure.com/support or report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with the official Azure Maps documentation you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ x ] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Open the indoor map sample code on Safari. (https://azuremapscodesamples.azurewebsites.net/?search=indoor&sample=Creator%20indoor%20maps)

Any log messages given by the failure

Expected/desired behavior

Indoor map will be loaded

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari
-Working on Chrome and Edge. Not working on Safari.

Mention any other details that might be useful


Thanks! We'll be in touch soon.

How to perform click event on Style Control buttons (Road and Satellite) ?

Dear Sir/Madam,

I have added style control in azure maps. Just road and Satellite map. Now, i want to perform action when clicked on any of these buttons. how to achieve this ?

This is my code for style control.

this.maper.controls.add([ new atlas.control.StyleControl({ mapStyles: ["road", "satellite_road_labels"], })],{ position: "bottom-right", });
image

I have read and found out about the event called - styledata here
but this event is fired everytime when there is a change in map or loads any new data.

this.maper.events.add("styledata", (e) => { console.log(e); });

How to get click event on this 2 buttons ?
Any help would be appreciated.

Thank you.

Azure Maps Fuzzy Search Limit parameter

Not sure if i the limit parameter is working as per description on the docs or something more needs to be added.

I am testing the fuzzy search api end point with different limit values and i am seeing an interesting behaviour, when my limit parameter is greater than 2 the /search/fuzzy API is returning only limit -1 results where i expect it to return the number of results requested in limit parameter.

see the attached image for the request log. Thanks

image

Dataset f523c2b1-ed4f-da44-542e-8c877a77397e does not contain any features to be rendered. The above error results when the tileset is created and the status URL of the resource is verified with the GET API. Is there any fix for this?

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with "official Azure Maps documentation** you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Strange results when entering an address

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting. If this issue is specific to the Azure Maps platform and not a sample itself, please raise this on the forums: https://stackoverflow.com/questions/tagged/azure-maps
- [ ] feature request
- [ ] documentation issue or request - Raise this on the forums: https://stackoverflow.com/questions/tagged/azure-maps
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

When entering an address, such as "1234 Park Place," everything is going as normal until I type the "a" in "Park." At that point the results seem to change from searching for the full address I've entered to only considering the "Pa" and nothing else. When I enter the next character everything is back to normal.

Any log messages given by the failure

Expected/desired behavior

I would expect the search to continue by searching for "1234 Pa" instead of just "Pa"

OS, Broswer and Version?

Windows 7
Chrome

Mention any other details that might be useful


Thanks! We'll be in touch soon.

mapboxgl , cannot find namespace

When trying to use Azure Maps with Typescript, I get this error in the definition file.
image

Reproduce by opening index.d.ts in VS Code.

Azure maps, show all search results as clusters

I noticed that when I show the results on the map, and if you have clustering enabled, you receive two types of shapes.

  • Clusters
  • Features ( On my case Persons )

I want to show all results as a list of persons, even when they are clustering to make this a reallity.

The Map:

Map

As you can see we have on 1 Cluster with 2 person. The reason is because on the data we have 2 shapes, the cluster feature and the person Feature.

To Achieve this goal we have done the next,

On Moveend event we store on 2 separated arrays the persons and the clusters:

   var clusters = [];
   var persons = [];
   data.forEach(function (shape) {
        if (typeof shape.properties !== "undefined") {
            if (shape.properties.cluster) {
                clusters.push(shape.properties);
            }
        } else if (typeof shape.properties === "undefined") {
            properties = shape.getProperties();
            persons.push(properties);
        }
    });

On the Persons array we have the information of the persons, but on the clusters array we have only the information of the cluster, so we iterate on this array to get every person of the array as follows,

         if (clusters.length > 0) {
            for (var i = 0; i < clusters.length; i++) {
                datasource.getClusterLeaves(clusters[i].cluster_id).then(function (children) {
                    for (var i = 0; i < children.length; i++) {
                        children.forEach(function (personProps) {
                            persons.push(personProps.properties);
                        });
                    }
                });
            }
        }

And i build the cluster layer as follows,

var clusterBubbleLayer = new atlas.layer.BubbleLayer(datasource, null, {
                radius: 15,
                color: '#007faa',
                strokeColor: 'white',
                strokeWidth: 2
            });

            map.layers.add(clusterBubbleLayer);

            var clusterLabelLayer = new atlas.layer.SymbolLayer(datasource, null, {
                iconOptions: {
                    image: 'none',
                    font: ['SegoeUi-Bold'],
                    anchor: 'center',
                    allowOverlap: true,
                    ignorePlacement: true
                },
                textOptions: {
                    textField: '{point_count_abbreviated}',
                    size: 12,
                    font: ['StandardFont-Bold'],
                    offset: [0, 0.4],
                    color: 'white'
                }
            });

            map.layers.add(clusterLabelLayer);

But I want to know if there is another method to show all records of the maps as clusters even when there is only one person?

Many Thanks!

Map, search tab,center marker and geolocation are perfect, but location markers are not displayed

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please conenct with the Azure support team at https://azure.com/support or report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with the official Azure Maps documentation you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Bug Report: Unable to drag and drop files on map

I am trying to drap and drop shape files in an angular application.

I have used code as per the same.

Shapefile.js is installed using npm install and catiline.js is added directly in index.html.
In the component I have used.

Declare var catiline:any;
Rest all the code is used the same way. shpworker.data(e.target.result) returns a promise but it doesnt get resolved.

Please let me know if I need to share the code.

Browser: Chome
OS: Windows 10
Angular 8

Quickstart interactiveSearch file throws exception when attempting to search

This issue is for a: (mark with an x)

- [ x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Following the Quickstart: Create an interactive search map by using Azure Maps guide.
  2. Complete Sign in, Create an account, and Download application sections.
  3. Complete steps 1-3 of Open application section.
  4. Attempt to complete step 4 "Try out the interactive search experience. In the search box on the upper-left corner of the demo web application, search for restaurants.".
  5. Get an undefined exception.

Any log messages given by the failure

atlas.min.js:formatted:38701 Uncaught TypeError: Cannot read property 'events' of undefined
    at Bs.r.close (atlas.min.js:formatted:38701)
    at search (AzureMapDemo.html:106)
    at AzureMapDemo.html:95

Expected/desired behavior

Search results to be returned.

OS, Browser and Version?

Windows 10 Pro
Chrome 78, Firefox Developer Edition 71

"code": "levelError","message": "Unable to build level outline for ordinal -1", While uploading custom package to the conversion API the above errors are received. Is there any fix for this issue?

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with "official Azure Maps documentation** you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Pins, polygon vertices and shape origins are offset from cursor

This issue is for a: (mark with an x)

- [x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Description

  • Pin drops, vertices and origins are progressively offset from cursor as cursor moves down and right on map.

  • Example:

offsetIssue

Expected/desired behavior

  • Pin would be dropped directly below cursor
  • Polygon origin and vertices will be drawn directly below cursor
  • Shape origins will be drawn directly below cursor

OS, Browser and Version?

  • Windows 10
  • Firefox

Mention any other details that might be useful

Please see issue reported on StackOverflow here.

How to host and use Azure Maps in WPF/UWP/Winforms?

Bing Maps have a WPF control but could not find any control which supports Azure Maps.
What is the suggested way to host and use Azure Maps in WPF/WinForms/UWP/MAUI Apps?

Web-browser control route doesn't work since Web-Browser does not allow any other built-in controls to be on top of the web-browser.

Ensure this is the right place

Ensur this is the right place to report your issue.

  • If your issue is with the Azure Maps platform itself and not specific to a code sample gallery, please conenct with the Azure support team at https://azure.com/support or report the issue on the forums: https://stackoverflow.com/questions/tagged/azure-maps
  • If your issue is with the official Azure Maps documentation you can use the feedback button on the documentation page to directly report the issue to the documentation team.

Reporting these types of issues using this methods will likely result in your issue being resolved quicker than if reported here.

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ X] bug report
- [X ] feature request
- [ X] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS, Browser and Version?

Windows 7, 8 or 10. Android, iOS.
Edge, Chrome, Firefox, Safari

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Edit polygon example

I'm looking for a code sample that shows me how to edit an existing polygon from Javascript/Typescript. I can find multiple examples of how to create one, but not how to edit.

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

What IDE/tool is used to develop the Azure Maps Code Samples?

This issue is for a: (mark with an x)

- [ ] bug report
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

Information on IDE/tool used to develop the Azure Maps Code Samples provided in this repo.
For example, how was the single page application interactiveSearch.html (under Tutorials) developed?
Is it possible to use Visual Studio 2019, and if so how?
Is it possible to use VS Code, and if so, what extensions?

OS, Browser and Version?

Windows 10 2004
Firefox

Mention any other details that might be useful

Thank you.

Loading Azure maps - It flashes the whole world first then it sets camera to its position

In depth issue -

When a user loads Map Page it initially loads a map of the whole world before quickly loading just the map portion required.

Goal - What i want is to direct moves to my desired location instead of flashing the whole world first.

Cause - As per my knowledge, this is caused due to following code -

  this.maper.events.add('ready', () => { })

Please guide me how to achieve this ?

SpiderClusterManager is not appropriately disposed

This issue is for a: (mark with an x)

- [x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Use the Spider Cluster Manager custom module.
  2. Call the dispose method.

Any log messages given by the failure

Cannot read property '_removeEventListener' of null

Expected/desired behavior

Dispose the custom module with no errors.

OS, Broswer and Version?

Windows 10
Chrome 76

Mention any other details that might be useful

The dispose method releases its resources in the wrong order.

The data source is cleared, removed and disposed before the layers. The layers have a dependency on the data source. The layers need to be removed first.

Then, the layers are removed from the map and disposed before their events are removed which also causes an error. The events need to be removed first.

I believe the order should be:

        // Remove layer events here ...

        // Remove the layers after the events have been removed
        this._map.layers.remove(this._spiderFeatureLayer);
        this._spiderFeatureLayer = null;

        this._map.layers.remove(this._spiderLineLayer);
        this._spiderLineLayer = null;

        // Remove the data source after layers have been removed
        this._spiderDataSource.clear();
        this._map.sources.remove(this._spiderDataSource);
        this._spiderDataSource = null;

Last, but not least, the events are not being removed. Since the callback functions are anonymous and no reference is retained, they cannot be removed by simply using another anonymous function that does the same thing.

eg.

The anonymous function callback in map.events.add('click', () => { this.hideSpiderCluster(); });
is not the same as the anonymous function callback in this._map.events.remove('click', () => { this.hideSpiderCluster(); });.

A possible solution would be to store the events in a private property to retain the anonymous function reference, then create an addEvents and removeEvents function.

private _events: SpiderClusterManagerEvent[] = []

   // ...
   
    map.layers.add(this._spiderFeatureLayer)

    this.setOptions(options)

    this._events.push(
      {
        eventType: 'click',
        callback: () => {  // <-- Anonymous function reference
          this.hideSpiderCluster()
        },
      }, // ...n events
    )

    this.addEvents()
  /**
   * Adds the events needed for the spider cluster manager to work.
   */
  private addEvents(): void {
    for (const evt of this._events) {
      if (evt.target) {
        this._map.events.add(evt.eventType, evt.target, evt.callback)
      } else {
        this._map.events.add(evt.eventType, evt.callback)
      }
    }
  }
  /**
   * Removes all the events added by the spider cluster manager.
   */
  private removeEvents(): void {
    for (const evt of this._events) {
      if (evt.target) {
        this._map.events.remove(evt.eventType, evt.target, evt.callback)
      } else {
        this._map.events.remove(evt.eventType, evt.callback)
      }
    }
  }

Map in form submits when any Control button is clicked

- [x] bug report
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Open Azure Map Controls example
  2. Wrap <div id="myMap"></div> in a form element.
  3. Click any control button
  4. The form is submitted

Demo: https://jsfiddle.net/cg90wm2t/

Any log messages given by the failure

None

Expected/desired behavior

Clicking a control button should not submit the form.

OS, Broswer and Version?

Windows 10
Chrome Version 74.0.3729.108 (Official Build) (64-bit)

Mention any other details that might be useful

The buttons are missing a type="button" attribute to prevent submitting the form.

Mapbox issue: mapbox/mapbox-gl-js#2934

Please provide example implementation for "getAuthTokenCallback"

Hello,

When using the authType set to anonymous, we are required to provide a callback function that then provides the token. This method is heavily used on this documentation page.

However, there are no examples provided on what this called method is supposed to return. Calling the URI directly from my browser returns an OAuth token (ey...) but the documentation here says [ Properties > getToken ]

A callback to use with the anonymous authentication mechanism. This callback will be responsible for resolving to a authentication token. E.g. fetching a CORS protected token from an endpoint.

"CORS protected token".. So the question is, what is going on behind the scenes and how does one come up with a "CORS protected token" ?

Get popup on hover instead of click + Spider Cluster

featureSelected - is called when i click on particular spider cluster icon. Is there any option for popup when hovered on particular spider cluster icon instead of click ?

See the image -
image

When i clicked on particular Spider cluster popup can be seen as seen below -
image

Instead of clicking on particular spider cluster icon -
image

This is my code -

  this.spiderClusterLayer = new SpiderClusterManager(this.maper, this.clusterLayer, this.symbolLayer, {
    featureSelected: (shape, cluster) => {
      if (cluster) {
        this.showPopup(cluster.geometry.coordinates, (shape.data.geometry.deviceName !== undefined ? shape.data.geometry.deviceName : shape.data.geometry.deviceImei), [0, 0], popup);
      } else {
        this.showPopup(shape.getCoordinates(), (shape.data.geometry.deviceName !== undefined ? shape.data.geometry.deviceName : shape.data.geometry.deviceImei), [0, -20], popup);
      }
    },
    featureUnselected: () => {
      this.hidePopup(popup);
    }
  });

Popup Functions -

showPopup(position, properties, pixelOffset, popup) {
  var html = ['<div class="card-body"><b style="text-align : center;">Assets Present</b><br/>'];
  html.push(properties);

  html.push('</div>');

  popup.setOptions({
    content: html.join(''),
    position: position,
    pixelOffset: pixelOffset
  });
  popup.open(this.maper);
}
hidePopup(popup) {
  popup.close();
}

I want to get popup on hover of icons instead of featureSelected. is there any featureHover option ?
Any help would be appreciated sir.

Clustering When zooming in and out

I had implemented the Cluster Pie Chart into my application. So far I had no problems in clustering the pin points with HTML marker. But there is an issue when I zoomed in and out on the cluster. For example there is cluster of 3 points when I zoomed to the cluster the cluster changes its number to 2 but it actually contains 3 I didn't see any individual HTML marker that is pointed along with the cluster number or it will disappear from the map view. Could you please help me with this issues as it is a really big concern for me. The cluster works when the zoom is made at particular point not at every point when zooming in and out. Thanks in advance
2021-01-16_00h12_49
2021-01-16_00h13_01
2021-01-16_00h13_18

Where are the Typescript samples?

This issue is for a: (mark with an x)

- [ ] bug report
- [x ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Expected/desired behavior

I'm attempting to switch away from import * and instead import just the types I am using in hopes to get better tree-shaking out of this package. I'm running into some problems with getting the updated import statements to be correct, so I came here to look at how the Typescript samples were doing it. Unfortunately, it seems like all of the samples in this repo are javacscript based. This reply #47 (comment) seems to indicate that they were moved somewhere else; however, the new location isn't mentioned in the reply nor the Project readme file.

Can someone point me to the location of the Typescript samples?
Or at least provide the correct import statement to import the Map type into my Typescript file?

Maps with Blazor

Hello, could you make examples using Blazor (code c #)? Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.