************* Spatial Input ************* **Last Updated:** June 2020 1. Spatial Input Controller =========================== Add a new controller to the :file:`controller.py` module: .. code-block:: python from .app import App @controller def draw(request): drawing_options = MVDraw( controls=['Modify', 'Move', 'Point', 'LineString', 'Polygon', 'Box'], initial='Polygon' ) map_options = MapView( height='450px', width='100%', layers=[], draw=drawing_options ) geometry = '' if request.POST and 'geometry' in request.POST: geometry = request.POST['geometry'] context = {'map_options': map_options, 'geometry': geometry} return App.render(request, 'draw.html', context) 2. Spatial Input Template ========================= Create a new :file:`draw.html` template in your template directory and add the following contents: .. code-block:: python {% extends tethys_app.package|add:"/base.html" %} {% load tethys %} {% block app_content %}
{{ geometry }}
{% endif %} {% endblock %} 3. Add Navigation Links ======================= Replace the ``app_navigation_items`` block of the :file:`base.html` template with: .. code-block:: html+django {% block app_navigation_items %} {% url tethys_app|url:'home' as home_url %} {% url tethys_app|url:'map' as map_url %} {% url tethys_app|url:'draw' as draw_url %}