[OpenLayers-Users] Re: problem with gml file in chrome and IE
Christian Mayer
mayer at terrestris.de
Tue Feb 22 08:05:21 EST 2011
Hello,
I am not quite sure if this is the solution but maybe you try:
put the instanciation of the stylemap objects (myStyleMap, myStyleMap2)
and before you use them. JSLint gives me warnings about that. Maybe this
is the problem.
Best regards,
Chris
Am 21.02.2011 08:44, schrieb adimopoulos:
> 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 })
> });
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110222/968ebb93/attachment.html
More information about the Users
mailing list