Browsed by
Category: OpenLayers

OpenLayers – Custom Style for Individual Features ?>

OpenLayers – Custom Style for Individual Features

Other than the subject, what’s included here, as following: Add Google Map as base map How to create vector layer How to add features to vector layer How to use WKT and display it on Map How to create dynamic label, radius & fill in OpenLayers Style How to display label based on zoom level

OpenLayers – Set Layer Ordering ?>

OpenLayers – Set Layer Ordering

We just need to use the following in order to set the layer ordering. var layer = map.getLayer(id);map.setLayerZIndex(layer,1000); Please take note, the following are the base z-index of each components in OpenLayers: OpenLayers.Map.Z_INDEX_BASE  ={ BaseLayer : 100, Overlay : 325, Feature : 725, Popup : 750, Control : 1000} Most of the layer overlays start it’s z-index from 725 + zIdx * 5(see OpenLayers.Map.setLayerZIndex() method. So if you pass a zIdx of 5, then the ordering of the overylay is…

Read More Read More

OpenLayers – Custom Feature Style ?>

OpenLayers – Custom Feature Style

Topic: OpenLayers – Custom Feature Style Descriptions: To enable custom style to a particular feature by using renderIntent & adding new styleMap. Get Feature; var o = target_layer.features[3]; Set Style Name; var styleName = + ‘_style’; Set render intent; o.renderIntent = styleName; Set the custom style; var style = new OpenLayers.Style({externalGraphic:’icons/marker_1.png’}); Add new style to styleMap; o.layer.styleMap.styles[styleName] = style; Assign back to the layer’s feature; target_layer.features[3] = o; Call redraw method in o.layer; o.layer.redraw();