Azure Maps atlas.io.read triggers popup by default

Aakash 60 Reputation points
2023-06-28T16:01:26.12+00:00

Hello,

I am using the azure maps spatial io read function to read files of type gpx, geojson, kml, kmz, etc and display the polygons and points rendered on the map. These files have properties which when clicked will display the file information via popup like Project Name, its location and any other information part of the properties tab.

I have a datasource variable defined as follows:

datasource = new atlas.source.DataSource(null, {
});

The loaded features are added to this datasource variable using the below code:

atlas.io.read(fileUrl).then(
	function (r) { 				
		if (r.features && r.features.length > 0) { 					
			datasource.add(r.features) 				
		} 				
		if (r.bbox) { 					
			map.setCamera({ 						
				bounds: r.bbox, 						
				padding: 50 					
			}); 				
		} 				
		else { 					
			map.setCamera({ 						
				bounds: atlas.data.BoundingBox.fromData(r), 						
				padding: 50 					
			}); 				
		} 			
})

The features get loaded onto the map, however, when clicking on the map, I notice that popup with information obtained from the polygon gets rendered. For instance, if I click on the map which corresponds to the polygon or any non point shape corresponding to r.features[0], the properties from r.features[0].properties gets displayed as a popup on the map. I do not wish for this default behavior to occur and I couldn't find a way to disable it anywhere.

I can confirm that there are no click based event handlers added to my map nor are there any popup being created from my end.

I would appreciate some insights on this.

For your reference, I've provided links to a list of files I have used for testing and that I have this issue with. They all use spatial io read function.

  1. https://ilogweb.blob.core.windows.net/gis-map-layers/host/tenants/aakash-test-5/canada.geojson
  2. https://ilogweb.blob.core.windows.net/gis-map-layers/host/tenants/aakash-test-5/test2.gpx
  3. https://ilogweb.blob.core.windows.net/gis-map-layers/host/tenants/aakash-test-5/unitedstates.kml

Thank you for your help

Best,

Aakash

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

Accepted answer
  1. rbrundritt 20,836 Reputation points Microsoft Employee Moderator
    2023-06-28T16:24:16.3533333+00:00

    The code you provided loads GeoJSON/KML data using atlas.io.read and adds it to a data source. That alone won't render anything on the map as the data source needs to be connected to a rendering layer of some sort. The Spatial IO module has the SimpleDataLayer class that simplifies rendering data parsed in this way and supports many of the built in style properties and popup experiences. The SimpleDataLayer class does provide its own popup experience that is enabled by default. This can be disabled by setting the enablePopups option of the SimpleDataLayer class to false. That said, if you know what type of data will be displayed, it would be more efficient to use the standard layers (e.g. PolygonLayer) since the SimpleDataLayer class wraps a minimum of 5 layers and uses complex style expressions.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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