Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geomap: Add support for logical operators #6678

Closed
muling opened this issue Apr 10, 2015 · 11 comments
Closed

Geomap: Add support for logical operators #6678

muling opened this issue Apr 10, 2015 · 11 comments
Assignees

Comments

@muling
Copy link

muling commented Apr 10, 2015

Need to add some business logic to the style rules for the map markers. It doesn't seem like this is currently supported.

We would like to do something like this:

  style: {
    rules: [
      new OpenLayers.Rule({
        filter: new OpenLayers.Filter.Logical({
          type: OpenLayers.Filter.Logical.AND,
          filters: [
            new OpenLayers.Filter.Comparison({
              type: OpenLayers.Filter.Comparison.EQUAL_TO,
              property: 'Data Available',
              value: 'Yes'
            }),
            new OpenLayers.Filter.Comparison({
              type: OpenLayers.Filter.Comparison.EQUAL_TO,
              property: 'Operation Schedule',
              value: 'Continuous'
            })
          ]
        }),
        symbolizer: {
          strokeColor: 'red',
          fillColor: 'red',
          pointRadius: '6',
        }
      })
@LaurentGoderre
Copy link
Member

@jvanulde please answer

@jvanulde
Copy link
Member

jvanulde commented May 8, 2015

@muling this is in progress.

@jvanulde
Copy link
Member

@muling we have something working now. Can you send me a sample file with some rules you need implemented? That way we can test against your requirements.

@muling
Copy link
Author

muling commented May 11, 2015

You mean the config rules file? Or can I just send you a plain description of the rules?

@jvanulde
Copy link
Member

Plain description will be sufficient. As well as a datasource/dataset that you intend to apply them too.

@muling
Copy link
Author

muling commented May 12, 2015

Config rules:
If schedule is continuous AND data_availabe=yes, then display green circle
Else if schedule is continuous AND data_availabe=no, then display red circle
Else if schedule is seasonal AND data_availabe=yes, then display a green square
Else if schedule is seasonal AND data_availabe=no, then display a red square

Sample Dataset (up to 8000 points):
Table headings:
Station Name,Province,Station Number,Data Available,Operation Schedule
ABITAU RIVER ABOVE CUMING LAKE,SK,07QC005,Yes,Continuous
ABITIBI RIVER AT ONAKAWANA,ON,04ME003,Yes ,Continuous
ADAMS LAKE,SK,11AB095,No,Seasonal
ADAMS RIVER NEAR SQUILAX,BC,08LD001,Yes,Continuous

The lat/lon for each point would be passed in somehow too.

@jvanulde
Copy link
Member

Thanks @muling that helps. So we have it working based on the psuedo-rules provided. Please see the screenshot below. We have some testing to do still but I am hoping we can push the update soon.

Result:

screen shot 2015-05-13 at 9 53 31 am

For you reference here is the configuration:

"style": {
"type": "rule",
"rule": [
  {
    "filter": "AND",
    "title": "Continuous - Data avail.",
    "filters": [
      {
        "field": "schedule",
        "value": ["continuous"],
        "filter": "EQUAL_TO"
      },
      {
        "field": "data_available",
        "value": ["yes"],
        "filter": "EQUAL_TO"
      }
    ],
    "init": {
      "strokeColor": "green",
      "fillColor": "green",
      "pointRadius": 8,
      "fillOpacity": 0.8,
      "strokeWidth": 2
    }
  },
  {
    "filter": "AND",
    "title": "Continuous - No data",
    "filters": [
      {
        "field": "schedule",
        "value": ["continuous"],
        "filter": "EQUAL_TO"
      },
      {
        "field": "data_available",
        "value": ["no"],
        "filter": "EQUAL_TO"
      }
    ],
    "init": {
      "strokeColor": "red",
      "fillColor": "red",
      "pointRadius": 8,
      "fillOpacity": 0.8,
      "strokeWidth": 2
    }
  },
  {
    "filter": "AND",
    "title": "Seasonal - Data avail.",
    "filters": [
      {
        "field": "schedule",
        "value": ["seasonal"],
        "filter": "EQUAL_TO"
      },
      {
        "field": "data_available",
        "value": ["yes"],
        "filter": "EQUAL_TO"
      }
    ],
    "init": {
      "strokeColor": "green",
      "fillColor": "green",
      "graphicName": "square",
      "pointRadius": 8,
      "fillOpacity": 0.8,
      "strokeWidth": 2
    }
  },
  {
    "filter": "AND",
    "title": "Seasonal - No data",
    "filters": [
      {
        "field": "schedule",
        "value": ["seasonal"],
        "filter": "EQUAL_TO"
      },
      {
        "field": "data_available",
        "value": ["no" ],
        "filter": "EQUAL_TO"
      }
    ],
    "init": {
      "strokeColor": "red",
      "fillColor": "red",
      "graphicName": "square",
      "pointRadius": 8,
      "fillOpacity": 0.8,
      "strokeWidth": 2
    }
  },
  {
    "elseFilter": true,
    "title": "Other",
    "init": {
      "pointRadius": 8,
      "strokeColor": "#666666",
      "graphicName": "triangle",
      "fillColor": "#666666",
      "fillOpacity": 0.8,
      "strokeWidth": 2
    }
  }
]
}

@muling
Copy link
Author

muling commented May 13, 2015

Is it possible to use our own icon? What shapes are available?

@jvanulde
Copy link
Member

You can use your own symbols. Or one of the predefined ones: "star", "cross", "x", "square", "triangle", and "circle" as value for the graphicName property of a symbolizer.

jvanulde added a commit to jvanulde/wet-boew that referenced this issue May 27, 2015
jvanulde added a commit to jvanulde/wet-boew that referenced this issue May 27, 2015
@hsrudnicki
Copy link

Can this issue be closed?

@muling
Copy link
Author

muling commented Jun 17, 2015

We haven't tested it ourselves yet, but you can close it.

jvanulde added a commit to jvanulde/wet-boew that referenced this issue Jun 23, 2015
LaurentGoderre added a commit that referenced this issue Jun 30, 2015
Addresses issues #6678, #6750, #6665 by adding support for MapQuest O…
jvanulde added a commit to jvanulde/wet-boew that referenced this issue Jul 27, 2015
jvanulde added a commit to jvanulde/wet-boew that referenced this issue Jul 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants