Visitas: 2
Para colocar iconos al Layer Vector en OpenLayers solo se tiene que colocar algunos atributos en styleMap.
Código JavaScript:
var v_geojson_layer = new OpenLayers.Layer.Vector("GeoJSON", {
styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
externalGraphic: 'http://www.openlayers.org/dev/img/marker-green.png',
graphicWidth: 21,
graphicHeight: 25,
graphicYOffset: -24
}),
"select": {
externalGraphic: 'http://www.openlayers.org/dev/img/marker-blue.png',
graphicWidth: 21,
graphicHeight: 25,
graphicYOffset: -24
}
}),
projection: new OpenLayers.Projection("EPSG:4326"),
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "http://eventos/mapas/listarEventos",
format: new OpenLayers.Format.GeoJSON()
})
});