OpneLayers3: How to add different type of markers to the map

المشرف العام

Administrator
طاقم الإدارة
I am looking for example of how to add markers of different type (different images) using OpenLayers2.

This is my code:

iconStyle = new ol.style.Style({ image : new ol.style.Icon(({ anchor : [ 0.5, 46 ], anchorXUnits : 'fraction', anchorYUnits : 'pixels', opacity : 0.75, src : '/icon.png' })) }); vectorSource = new ol.source.Vector({ features : [] }) vectorLayer = new ol.layer.Vector({ source : vectorSource, style : iconStyle }); map.addLayer(vectorLayer); I cant to have more than one icons. For example if user clicks on map, marker from one source is displayed, and when he enters an address, a marker form another source is displayed.

How this should be managed? Do I nee to create multiple iconSyle, vectorSource and many vectorLayer attached to map?



أكثر...
 
أعلى