How to prevent proxy servers from overlapping with the same geolocation using Bing Maps?

If you have two buttons on London in the same geolocation, is there anything in the API to move them so that they are visible?

I can find documentation on my old map point APIs that had PreventIconCollisions, this is what I want, but I don't see any reference to this in the new API.

I am using the JavaScript API.

+4
source share
2 answers

So, if I understand correctly, you have similar information in the same place, is that right?

To display both information, you will have two options:

  • Combine the information in a text box using the appropriate way to present the information inside this ui element (for example, using your own tabbed tab)
  • Mark a point manually when you are at a certain zoom level.

There is no default property to set this, and it would be useless to do this on many supports, but in the main idea you would need to: detect the changechangeend event, if you are at a certain zoom level (or a higher zoom level), then you have them decompress (I call it decluter next to the buttons).

// Bind pushpin mouseover. Microsoft.Maps.Events.addHandler(pin, 'mouseover', function (e) { var currentPin = e.target; currentPin.setOptions({ visible: false }); var currentLocation = currentPin.getLocation().clone(); var currentPoint = bmGlobals.geo.map.tryLocationToPixel(currentLocation); if (currentPin.associatedCluster.length == 2) { // Display the first pushpin var pinA = createPin(currentPin.associatedCluster[0]); var locA = bmGlobals.geo.map.tryPixelToLocation(new Microsoft.Maps.Point(currentPoint.x - pinA.getWidth(), currentPoint.y)); pinA.setLocation(locA); bmGlobals.geo.layerClusteredPin.push(pinA); // Display the second pushpin var pinB = createPin(currentPin.associatedCluster[1]); var locB = bmGlobals.geo.map.tryPixelToLocation(new Microsoft.Maps.Point(currentPoint.x + pinB.getWidth(), currentPoint.y)); pinB.setLocation(locB); bmGlobals.geo.layerClusteredPin.push(pinB); } }); 

I will try to write a bing card module about this, but in this case you will have to get your cluster buttons (or your own button that has two connected data objects), and then you will need to set your position based on client-side rendering.

0
source

I know this question is really old, but if someone is looking for something like this (clustering contacts), here is a good start: http://rtsinani.imtqy.com/PinClusterer/

0
source

Source: https://habr.com/ru/post/1403868/


All Articles