I am using entity collections to specify different layers on my Bing map. I have a gps layer representing the user location, and a poi layer representing the POIs shown on the map, as follows:
poiLayer = new Microsoft.Maps.EntityCollection();
map.entities.push(poiLayer);
gpsLayer = new Microsoft.Maps.EntityCollection();
map.entities.push(gpsLayer);
I want the gps pushpin above the poi ones, but the gps layer always ends up under the poi layer. This is not optimal, since the single gps pushpin could be hidden underneath.
I have tried reordering how the entities are pushed to the map variable, and the order of constructing new pushpins for gps and poi, but I've had no luck. Does anyone have a solution for this?
When you create GPS and POI pins, use a PushpinOptions Object to give the GPS pins a higher z-index than you give POI pins.
Note that the EntityCollection
s themselves are not "layers" - they're merely collections of objects. Each entity inside them can have a z-index.