Pushpin z-Index

I would like to be able to control which pushpins are ontop of each other. I have tried changing the z-Index on the stylesheet with no success.

And after looking at the javascript, the map.AddPushpin function actually uses a global variable for the z-index when it adds the pushpin to the mapcontrol.

this.vemapcontrol.AddPushpin(GA.ID,veLatLongDecoded.Latitude,veLatLongDecoded.Longitude,25,25,"VEAPI_Pushpin",GA.GetContent(),Msn.VE.API.Globals.vepushpinpanelzIndex-1);

Has anyone else came across this problem and came up with a reasonable solution besides just overwriting the map.AddPushpin method



Answer this question

Pushpin z-Index

  • martin.kolarik

    I thought about that as well and it does work to some degree. Mainly the issue is when you are adding pushpins dynamicly and the one you are adding should be 'below' other ones i would have to remove all the ones that should be above it and readd them.

    Basically I have type X and type Y pushpins and X should always be above Y and you can add both types of pushpins to the map at anytime.

    I was just curious if there was a easier solution. If not I'll probably just end up writing a function to use the vemapcontrol.Addpushpin()


  • Frank V

    I really want to change the order of the pushpins.
  • BobH

    Nice.
    It appears to me that the order they appear in is the order in which you add them ie the last one is on top.
    Correct me if i am wrong but couldn't you just add them to the map in the order you want
    John.


  • Davids Learning

    Yeah i see the issue, and every time you zoom it will change which pins overlap.
    I guess you need to be a little careful with the z-order or else your pins may show through a panel or get hidden by something else.
    Depending on the number of pins your talking about it maybe simplier to keep an array of pins and remove them then add them all in the right order when you add your new pin. Otherwise won't you need to go back and readjust all the z-orders of the existing pins And won't you potentially run out of z-order values 0-1000 right
    John.


  • PiGuy

    I think if I just use the vemapcontrol.AddPushpin() it will be much simplier and I can just have my X pins have a z-index of like 999 and my Y pins a z-index of 998 or something like that so any existing already have the correct z-index value and any new pins added would have there z-index value set correctly. Like you said I might have to mess around with controls and such to make sure the indexes are really what i want and arent hidden/showing when I dont want them to be. But adding and removing all the pins everytime you zoom or add a new pin seems like a lot of unneccessary work and a larger slowdown for map navigation.


  • Sushisource

    Do you really want to change the order of the pushpins or would moving them so they don't overlap or creating a megacluster be an option
    Dr neil has a nice example of how to detect when pins overlap in javascript or else I put up a clustering solution over at viavirtualearth.
    John.


  • Chongkai

    Sorry if you only have two groups then sure.
    But you can see if you had hundreds of groups or where doing it on a pin by pin basis you could end up in trouble.
    I was a little confused by what you were tring to do.
    John.


  • Pushpin z-Index