mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

multiple points with exactly the same location

Open EgbertBleyenburg opened this issue 8 years ago • 4 comments

mapbox-gl-js version: https://api.mapbox.com/mapbox-gl-js/v0.42.0/mapbox-gl.js

Question

I load a geojson into a map and display all points with symbols, but a lot of points have the exact same geolocation. So then my cluster shows f.i. 10 points, but zooming in it only shows one symbol (marker)

Ive added two cluster layers

map.addLayer({ id: 'clusters', type: 'circle', source: 'airports', paint: { 'circle-opacity': 0.4, // 'circle-blur': 0.3, 'circle-color': { property: 'point_count', type: 'interval', stops: [ [1, '#111111'], [3, '#111111'], [5, '#111111'], ] }, 'circle-radius': { property: 'point_count', type: 'interval', stops: [ [1, 17], [3, 17], [5, 17] ] } } });

map.addLayer({ id: 'cluster-count', type: 'symbol', source: 'airports', filter: ['has', 'point_count'], layout: { 'text-field': '{point_count}', 'text-font': ["Bariol Bold", "Arial Unicode MS Bold"], 'text-size': 14, 'text-offset': [0, 0.2], }, paint: { "text-color": "#ffffff" } });

and a 'marker' layer

	            map.addLayer({
	                id: 'airport',
	                type: 'symbol',
	                source: 'airports',
	                filter: ['!has', 'point_count'],
	                layout: {
	                   	'icon-image': loadthemarker,
	                    'icon-size': 1,
	                    'icon-allow-overlap': true,
	                    'text-allow-overlap': false,
	                    'text-field': "{name}",
                    'text-font': ["Bariol Bold", "Arial Unicode MS Bold"],
	                    'text-size': 11,
	                    'text-offset': [0, 1.8],
	                    'text-anchor': "top"
	                }
	            });

How to show the multiple points (symbols) that have the same location

Links to related documentation

EgbertBleyenburg avatar Nov 21 '18 16:11 EgbertBleyenburg

  • You didn't provide us with a link to a minimal reproducible test case.
  • This is a pretty old version of GL JS.

So unfortunately I'll have to close the issue.

mourner avatar Nov 21 '18 18:11 mourner

@mourner I am able to reproduce the mentioned issue with mapbox-gl v0.53. i have attacked geojson which i want to plot on map. At max zoom level only single icon is visible.

cluster = supercluster({ radius: 10, maxZoom: 19, minZoom: 15 }); Please help

geojson.txt

Please check this url. I am able to reproduce the issue with latest mapbox-gl version https://jsfiddle.net/Vyankat/0ncb78tu/3/

vyankat70war avatar Feb 22 '19 08:02 vyankat70war

I got the same issue.

abozhang avatar Apr 10 '19 13:04 abozhang

But this is by design. Clustering only has its functionality if points differ in location and when zooming out nearby points are clustered into one. Zooming in will show the individual points. But clustering points laying exactly "on top of each other" has no meaning.

Bernoulli-IT avatar Oct 13 '20 12:10 Bernoulli-IT