Z-Index/Y-Order Example

This example shows the use of z-indexing and y-ordering of external graphics. Zoom in and out to see this behavior.

Z-Index (with Y-Ordering enabled)

In this map, the gold features all have the same z-index, and the red features have alternating z-indeces. The gold features' z-index is greater than the red features' z-indeces, which is why gold features look to be drawn on top of the red features. Since each gold feature has the same z-index, gold features succomb to y-ordering: this is where features that seem closest to the viewer (lower lattitude) show up above those that seem farther away (higher lattitude).

All vector layers have z-indexing enabled by default, but are not enabled with y-ordering. You can enable y-ordering by passing the parameter yOrdering: true in the vector layer's options hash. For all configurations, if features have the same z-index -- and if y-ordering is enabled: the same lattitude -- those features will succomb to drawing order, where the last feature to be drawn will appear above the rest.

Drawing Order (no Z-Indexes set, and Y-Ordering disabled)

In this map, features are not given z-indexes, and the layer's yOrdering parameter is set to the default (false). This configuration makes features succomb to drawing order instead of z-index order or y-order.

The features in this map were drawn from left to right and bottom to top, diagonally, to show that y-ordering is not enabled.