[OpenLayers-Dev] rules and filters. i'm confused [solved]

Garthanos lancelot at inetnebr.com
Fri May 23 14:43:19 EDT 2008


Thanks I must have been dealing with wierd caching issues.. 
retried a case I was certain was not working when it was a GML
and tadah it just worked.. argh.


Dejung Gewissler-2 wrote:
> 
> I am pretty sure that the styling classes and data formats are separate 
> because I actually use GML also in a similar fashion. It seems that the 
> difference now is in the Rule class. Before the filters were in the Rule 
> class, but now they have moved to a Filter class. That was my problem.
> 
> The example below uses the new Filter class and since you are using 
> OpenLayers.Layer.GML it expects the data to be in GML (unless you 
> specify a different format like I did previously).
> 
>     var selectStyle = new OpenLayers.Style({"strokeColor": "red", 
> "strokeOpacity": 1, "strokeWidth": 3, "strokeLinecap": "round"});
>     var c_style = new OpenLayers.Style();
>     var c_l = new OpenLayers.Rule({
>         filter: new OpenLayers.Filter.Comparison({
>             type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
>             property: "pop2000",
>             value: 44000
>         }),
>         symbolizer: {
>             Polygon: {fillColor: "#FFFF00", strokeColor: "blue"}
>         }
>     });
>                
>     var c_else = new OpenLayers.Rule({
>         elseFilter: true,
>         symbolizer: {
>             Polygon: {fillColor: "#0000FF", strokeColor: "blue"}
>         }
>     });
> 
>     c_style.addRules([c_l, c_else]);
>    
>     var cLayer = new OpenLayers.Layer.GML("Counties", "data/counties.txt",
>         {visibility:false,
>             styleMap: new OpenLayers.StyleMap({
>                 "default": c_style,
>                 "select": selectStyle})       
>         }
>     );
>     OGIS.map.addLayer(cLayer);
> 
> Hope that helps,
> Dejung
> 
> 
> 
> Garthanos wrote:
>> So basically you solved this issue by switching to GeoJSON Layer Type.. I
>> need the GML layer to work or the WFS layer to integrate filters (as well
>> as
>> bbox)
>>
>> Basically seems like the GML Layer type in 2.6 has no styling capability
>> is
>> that correct?
>>
>>
>>
>>   
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> 

-- 
View this message in context: http://www.nabble.com/rules-and-filters.-i%27m-confused-tp17329314p17432652.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list