On 05/26/2013 08:20 AM, Roberto Maurizzi wrote:
> What would you recommend to achieve this, short of using JS to create
> or move the legend inside the map div?
>
This is what I would recommend. The map will be useless without
javascript anyway, so there's no reason not to have javascript as a
requriement. The map div will be rendered immediately on page load, so
your template could look something like this:
{{ map }}
<div id='my_legend'><!-- your legend code here --></div>
<script type='text/javascript'>
var mapDiv = document.getElementById('id_map'); // The ID will come
from your instantiation.
var legend = document.getElementById('my_legend');
mapDiv.appendChild(legend);
</script>
Then, your style would be something like:
<style type='text/css'>
#id_map { position: relative; }
#my_legend { position: absolute; left: 0; bottom: 0; width: 100px;
height: 100px; }
</style>
This is, I believe, the most succinct, clear, portable, and
un-spaghetti-code way to accomplish your goal given the current
limitations of olwidget.
best,
Charlie