[OpenLayers-Users] Re: how to style vector layer points from values
of GeoRSS tag?
fabiowebby
fabiowebby at yahoo.it
Fri Aug 5 19:49:43 EDT 2011
Hi Marc,
thank you very much for your reply. I tried to follow the tutorial you
posted but unfortunately it does not work. now I cannot see the points
anymore. I came up with the following code:
var map = new OpenLayers.Map("map");
var style = new OpenLayers.Style();
var ruleLow = new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LESS_THAN,
property: "magnitude",
value: 3,
}),
symbolizer: {pointRadius: 10, fillColor: "green",
fillOpacity: 0.5, strokeColor: "black"}
});
var ruleHigh = new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
property: "magnitude",
value: 3,
}),
symbolizer: {pointRadius: 20, fillColor: "red",
fillOpacity: 0.7, strokeColor: "black"}
});
style.addRules([ruleLow, ruleHigh]);
var vector_style_map = new OpenLayers.StyleMap({
'default': style
});
var google_hybrid = new OpenLayers.Layer.Google("Google Hybrid",
{type: google.maps.MapTypeId.HYBRID});
var earthquakes = new OpenLayers.Layer.Vector("Earthquakes", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "files/test.xml",
format: new OpenLayers.Format.GeoRSS()
})
});
map.addLayers([earthquakes,google_hybrid]);
map.zoomToMaxExtent();
earthquakes.styleMap = vector_style_map;
Could you please tell me what I am doing wrong? Could it be because the
magnitude tag values are decimal point numbers(3.25,2.77 etc)?
Thank you very much in advance
Regards
Fabio
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/how-to-style-vector-layer-points-from-values-of-GeoRSS-tag-tp6655038p6658469.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list