[OpenLayers-Users] Re: problem with gml file in chrome and IE

adimopoulos dimoaris at gmail.com
Mon Feb 21 02:44:11 EST 2011


Hi again

Just to update my previous post. I'm placing here the parts of my code. Hope
someone can help....

	// Add a masts file
		var layer1 = new OpenLayers.Layer.GML("MASTS", "MASTS.gml",{
			projection: new OpenLayers.Projection("EPSG:4326") ,
			styleMap: myStyleMap,
                rendererOptions: {zIndexing: true}

		});              
	// Add a projects file
		var layer2 = new OpenLayers.Layer.GML("projects", "./projects.gml",{
			projection: new OpenLayers.Projection("EPSG:4326"),
			formatOptions: {
              extractStyles: true, 
              extractAttributes: true,
              maxDepth: 2
            },
			styleMap: myStyleMap2,
                rendererOptions: {zIndexing: true}

		});              

and my stile 

	var myStyleMap = new OpenLayers.StyleMap( {
            "default":new OpenLayers.Style({
            fillColor: '${color1}', strokeColor: 'black', strokeOpacity:
0.8, strokeWidth: 0.8, fillOpacity: 0.8, pointRadius: "${radius}" },
                                //call attribute of style in order to modify
                         {
                               context: {
                                        color1: function(feature) {
                                                               
if(feature.attributes.Status == "DEAD")
                                                                    {
                                                                       
selectedColor = "red";
                                                                    }
                                                                else 
                                                                    {
                                                                       
selectedColor = "green";
                                                                    } 
																	return selectedColor;
                                                },
										radius: function(feature) {
															return Math.min(Math.pow(Math.max(feature.attributes.Mean_u,
5), 1.9)*0.2, 13);
										}
								}
			}),
			"select":new OpenLayers.Style({
                                fillColor: '#66ccff', strokeColor: 'black',
strokeOpacity: 1, fillOpacity: 0.7, pointRadius: "5px" })
		});
	// projects style	
	var myStyleMap2 = new OpenLayers.StyleMap( {
                        "default": new OpenLayers.Style({
                                fillColor: 'blue', strokeColor: '#3399ff',
strokeOpacity: 1, fillOpacity: 0.5 }),
						"select": new OpenLayers.Style({
                                fillColor: '#66ccff', strokeColor:
'#3399ff', strokeOpacity: 1, fillOpacity: 0.5 })
	});


-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/problem-with-gml-file-in-chrome-and-IE-tp6040200p6047830.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list