Skip to content
perrygeo edited this page Jun 13, 2012 · 11 revisions

Quick sketch of layer manager app

Should probably be madrona.layermanager as it could be useful in other 2D maps?

Models

class RadioGroupLayer(object):
    tilelayers = ManyToMany(TileLayer)

class TileLayer(object):
    name = CharField... # layer name
    order = FloatField... # higher number = on top
    description = TextField...
    tile_url = TextField... # use ${x}, ${y}, ${z} for url 
    utfgrid_url = TextField... # use ${x}, ${y}, ${z} for url
    utfgrid_template = TextField... # mustache template for utfgrid rendering
    utfgrid_event = CharField... # move or click?
    theme = ManyToMany # a layer can show up in > 1 theme.
    link = ManyToMany...
    tags = TextField... # for search, etc
    legend = ImageField... 
    abstract = TextField...
    thumbnail = ImageField...
    bookmark_url = URLField...

class Link(object):
    name = CharField  # ie "KML" or "Shapefile" or "Source Site" or "FGDC metadata"
    url = URLField...

class Theme(object):
    name = CharField...
    blurb = TextField...

Views

Return a json structure describing the layout of the data

[
  'layers': [
     {'name': 'Layer1', 
      'themes': ['Fishing', 'Conservation'],
      'tile_url': 'http://server.arcgisonline.com/World_Physical_Map/${z}/${y}/${x}',
      'tags': 'Retro food truck qui nostrud banksy occaecat polaroid tempor sriracha adipisicing labore vegan",
      'links': ['KML': 'http://blah.kml', 'FGDC XML': 'http://blah.xml', ...]
     },   
     {'name': 'Layer2', ...},
     ...
  ]
]

templates

  • maybe a simple djangotemplate-based openlayers html view for testing only.

  • Actual client side would hook into openlayers API (add the layer, create collapsable/searchable accordion layer switcher)

  • Client side could also parse the list in "catalog" mode and display as an accordion data catalog with links.

Admin interface

we'd need one.. maybe just vanilla django for now?

How do UTFGrids fit into this?

If the UTFGrid fields are set, load the utfgrid tiles and create a callback that will fill in the mustache templates for each visible layer and do whatever with the text (probably just stuff it in a div somewhere). Probably need a control and callback for both move and click events. The layer switcher would need to control the "visibility" of the utfgrid layer along with the tile layer so that interactivity is turned off when the associated tiles are not visible.