Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am working with OpenLayers and GeoExt and I have the following problem:

I have a point vector layer and I want to create a style that contains 2 symbolizers. In this example they show how this could be achieved with Geo Ext Feature Renderer. My question is: how do I connect the renderer to the layer once I create it? I saw that GeoExt.FeatureRenderer has 'feature' as a config option, so I tried to apply it to one feature in my vector layer, but the feature is still displayed with the vector layer's default style. This is a simple code of what I tried to do:

map = new OpenLayers.Map('map_element');
var ol = new OpenLayers.Layer.OSM();
map.addLayer(ol);
map.setCenter(new OpenLayers.LonLat(16.371,48.209).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")), 0 );

var vector_feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(0,0));
var vector_layer = new OpenLayers.Layer.Vector();
vector_layer.addFeatures([vector_feature]);
var multipleSymbol = [{
                            pointRadius: 8,
                            fillColor:"green",
                            strokeColor:"#000",
                            strokeWidth:1
                        },{
                            graphicName:"star",
                            pointRadius:5,
                            fillColor:"white"
                        }];
var config_options ={symbolType: 'Point',
            symbolizers:multipleSymbol,
            feature: vector_feature,
            xtype:'gx_renderer'};
Ext.Loader.load(['GeoExt.FeatureRenderer']);
Ext.onReady(function() { Ext.create(config_options)});
map.addLayer(vector_layer);

Thanks for your help! Raluca

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.