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

Masking in MAMLAdapter #4571

Merged
merged 5 commits into from
Feb 7, 2019
Merged

Conversation

jisantuc
Copy link
Contributor

@jisantuc jisantuc commented Feb 1, 2019

Overview

This PR adds masking to the MAMLAdapter for running analyses only on specific areas.

Checklist

  • Description of PR is in an appropriate section of the changelog and grouped with similar changes if possible

Demo

image

Notes

It doesn't include a frontend strategy for letting users specify masks or a backend strategy for getting masks from layers. It just makes it so that we can definitely choose to do one of those things or something else to get a mask.

[WIP] until geotrellis/maml#72 is merged and we can bump the maml version

Testing Instructions

  • create an analysis
  • in the database, replace its execution parameters with the following json, just changing the project id to a project you have with a scene with at least 1 band. The geometry in this mask is near Sodo, Ethiopia, so a MODIS scene from there would do the trick.
{
  "id": "1c42894b-93ba-4972-83e0-86e8a6f8a47a",
  "args": [
    {
      "id": "d0486baf-e8e6-432c-8dcb-6ca7ad47eedc",
      "args": [
        {
          "id": "dfac657d-9af5-4765-b90b-bdbdc035646a",
          "args": [],
          "type": "const",
          "constant": "1",
          "metadata": {
            "label": "1"
          }
        },
        {
          "id": "b5453973-a92f-4ab8-be31-0f013688f3a2",
          "args": [],
          "band": 1,
          "type": "projectSrc",
          "projId": "CHANGE ME I'M DEFINITELY NOT A UUID",
          "metadata": {
            "label": "x"
          }
        }
      ],
      "apply": "*",
      "metadata": {
        "label": "multiply",
        "collapsable": true,
        "histogramOptions": {
          "range": {
            "max": 5100,
            "min": -10
          },
          "baseScheme": {
            "dataType": "SEQUENTIAL",
            "colorBins": 0,
            "colorScheme": [
              "#440154",
              "#482374",
              "#404387",
              "#345E8D",
              "#29788E",
              "#208F8C",
              "#22A784",
              "#42BE71",
              "#79D151",
              "#BADE27",
              "#FDE724"
            ]
          }
        },
        "renderDefinition": {
          "clip": "none",
          "scale": "SEQUENTIAL",
          "breakpoints": {
            "-10": "#440154",
            "501": "#482374",
            "1012": "#404387",
            "1523": "#345E8D",
            "2034": "#29788E",
            "2545": "#208F8C",
            "3056": "#22A784",
            "3567": "#42BE71",
            "4078": "#79D151",
            "4589": "#BADE27",
            "5100": "#FDE724"
          }
        }
      }
    }
  ],
  "mask": {                                                                                                                                                                                                        
    "type": "MultiPolygon",                                                                                                                                                                                        
    "coordinates": [                                                                                                                                                                                               
      [                                                                                                                                                                                                            
        [                                                                                                                                                                                                          
          [                                                                                                                                                                                                        
            4265797.674539117,                                                                                                                                                                                     
            787607.1394504562                                                                                                                                                                                      
          ],                                                                                                                                                                                                       
          [                                                                                                                                                                                                        
            4122096.061362985,                                                                                                                                                                                     
            816347.4620856825                                                                                                                                                                                      
          ],                                                                                                                                                                                                       
          [                                                                                                                                                                                                        
            4078068.3330707247,                                                                                                                                                                                    
            726457.5168223152                                                                                                                                                                                      
          ],
          [
            4130657.008530925,
            628618.1206172896
          ],
          [
            4222992.938699418,
            590093.8583615617
          ],
          [
            4296983.98207947,
            735018.4639902555
          ],
          [
            4265797.674539117,
            787607.1394504562
          ]
        ]
      ]
    ]
  },
  "apply": "mask",
  "metadata": {
    "label": "mask",
    "collapsable": false
  }
}
  • if necessary/if you didn't go to Ethiopia, replace the geometry with a geometry within the bounds of the project you've chosen
  • visualize the mask node on the map

Closes #4532

Closes #4169

@jisantuc jisantuc force-pushed the feature/js/add-masking-to-maml branch from 70eec3e to 350a86f Compare February 6, 2019 23:35
@jisantuc jisantuc changed the title [wip] Masking in MAMLAdapter Masking in MAMLAdapter Feb 6, 2019
val decoded = executionParams.as[MapAlgebraAST] match {
case Right(x) => x
case Left(e) =>
logger.error(e.getMessage)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@notthatbreezy notthatbreezy merged commit 7907085 into develop Feb 7, 2019
@notthatbreezy notthatbreezy deleted the feature/js/add-masking-to-maml branch February 7, 2019 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants