Skip to content

SiteFilteringSpatialAnalysis.wiki

Matthew Perry edited this page Dec 17, 2011 · 1 revision

Site Filtering and a framework for spatial analyses within MarineMap

Introduction

Scott brought up the case for a Wave Energy Site Filtering tool in OMM. It might be good to sketch out some ideas about how that might be implemented so as to be a reusable tool for spatial analyses within lingcod.

Server-side

MP: One potential idea might be to have a Feature base class to define spatial analyses.

#lingcod.features.models
class SpatialAnalysis(Feature):
    ....

class SpatialAnalysisForm(FeatureForm):
    ....

#myapp.models
from lingcod import analysis

@register
class WaveEnergySiteFilter(SpatialAnalysis):
    sdepth = analysis.Input('Seafloor Depth', analysis.widgets.slider),
    dshore = analysis.Input('Distance to Shoreline', analysis.widgets.dropdown)
    analysis_backend = 'myapp.analysis.ProcessWaveSite'
    output = analysis.outputs.kml()
    class Options:
        verbose_name = 'Wave Energy Site Filtering'
        form = 'myapp.models.WaveEnergySiteForm'
     

class WaveEnergySiteForm(SpatialAnalysisFilter):
    class Meta:
        model = WaveEnergySiteFilter

This would allow a few key things:

  • All input parameters specified in models
  • 'Create New' Wave Energy Site Filter would bring you to a form that could be autogenerated based on the inputs
  • The parameters would be passed to a custom backend which could do whatever the heck it wanted
  • results could be stored temporarily
  • the entire instance could be saved/copied to the users account
  • the instance could be shared, copied, etc and editing the copied version would bring back the form with all the original input parameters.

From Scott -- I like this idea alot. If we were to go this route, then the Create New Wave Energy Sites panels could look something like the following:

Create New Wave Energy Site (Parameters)

Create New Wave Energy Site (Attributes)

The result of which would likely be an actual collection of sites which could be housed in a Wave Energy Site collection.