[OpenLayers-Users] Creating styles based on the values
of calculated variables.
Mak Kolybabi
mak.kolybabi at telenium.ca
Wed Jul 14 10:54:08 EDT 2010
On 07/14/2010 09:40 AM, Dheeraj Chand wrote:
> I am curious if anyone has done something like what I am trying to do. My goal is to allow a user to select any two variables by means of a form. These variables could be, say, the number of people in Texas, by county, from 1991 to 1999. The goal is then to create a new variable, Var3, where Var3 = (Var1 - Var2) and then style the entire map based on the value of Var3. (Each variable would obviously represent an attribute of the layer) I have got everything down except how to build a style based on the value of a derived variable. Any advice?
Not sure if this is exactly what you're looking for, but it's possible to have a
style that has function-backed portions:
> style_park = new OpenLayers.Style(
> {
> display: "${display}",
> externalGraphic: "/images/park/sk-park.png",
> // Original is 97x97.
> graphicWidth: 25,
> graphicHeight: 25
> },
> {
> context: {
> display: function (feature) {
> return (feature.data.url) ? "show" : "none";
> }
> }
> }
> );
--
Mak Kolybabi
Programmer
Telenium Inc.
204-957-2821
More information about the Users
mailing list