diff --git a/src/wuttafarm/web/templates/assets/master/view.mako b/src/wuttafarm/web/templates/assets/master/view.mako
index dac5a1c..5b7b822 100644
--- a/src/wuttafarm/web/templates/assets/master/view.mako
+++ b/src/wuttafarm/web/templates/assets/master/view.mako
@@ -10,5 +10,74 @@
% endif
- ${parent.page_content()}
+
+
+ ## main form
+
+ ${parent.page_content()}
+
+
+ ## location map
+ % if map_polygon:
+
+ % endif
+
+
+
+%def>
+
+<%def name="modify_vue_vars()">
+ ${parent.modify_vue_vars()}
+ % if map_polygon:
+
+ % endif
%def>
diff --git a/src/wuttafarm/web/templates/base.mako b/src/wuttafarm/web/templates/base.mako
index b28b52f..caa5c67 100644
--- a/src/wuttafarm/web/templates/base.mako
+++ b/src/wuttafarm/web/templates/base.mako
@@ -1,6 +1,16 @@
<%inherit file="wuttaweb:templates/base.mako" />
<%namespace file="/wuttafarm-components.mako" import="make_wuttafarm_components" />
+<%def name="head_tags()">
+ ${parent.head_tags()}
+
+ ## TODO: this likely does not belong in the base template, and should be
+ ## included per template where actually needed. but this is easier for now.
+
+
+
+%def>
+
<%def name="index_title_controls()">
${parent.index_title_controls()}
diff --git a/src/wuttafarm/web/views/assets.py b/src/wuttafarm/web/views/assets.py
index 64f4dbc..35c3b21 100644
--- a/src/wuttafarm/web/views/assets.py
+++ b/src/wuttafarm/web/views/assets.py
@@ -23,6 +23,7 @@
Master view for Assets
"""
+import re
from collections import OrderedDict
from webhelpers2.html import tags
@@ -359,6 +360,36 @@ class AssetMasterView(WuttaFarmMasterView):
return buttons
+ def get_template_context(self, context):
+ context = super().get_template_context(context)
+
+ if self.viewing:
+ asset = context["instance"]
+
+ # add location geometry if applicable
+ if asset.is_fixed and asset.farmos_uuid and not self.app.is_standalone():
+
+ # TODO: eventually sync GIS data, avoid this API call?
+ client = get_farmos_client_for_user(self.request)
+ result = client.asset.get_id(asset.asset_type, asset.farmos_uuid)
+ geometry = result["data"]["attributes"]["intrinsic_geometry"]
+
+ context["map_center"] = [geometry["lon"], geometry["lat"]]
+
+ context["map_bounds"] = [
+ [geometry["left"], geometry["bottom"]],
+ [geometry["right"], geometry["top"]],
+ ]
+
+ if match := re.match(
+ r"^POLYGON \(\((?P[^\)]+)\)\)$", geometry["value"]
+ ):
+ points = match.group("points").split(", ")
+ points = [[float(pt) for pt in pair.split(" ")] for pair in points]
+ context["map_polygon"] = [points]
+
+ return context
+
def get_version_joins(self):
"""
We override this to declare the relationship between the