[GeoNode-users] Tip: how to use custom groups in Legend

Simone Dalmasso simone.dalmasso at gmail.com
Tue Aug 2 13:23:49 PDT 2016


Amedeo, thanks a lot for sharing this!

2016-08-02 10:11 GMT+02:00 Amedeo Fadini <amefad at gmail.com>:

> Hi everybody,
>
> maybe all of you already knows how to setup different groups in the
> geoexplorer toc (layercontainer)  for geonode maps...  the default
> installations has two groups, "overlay" an "backgrounds".
>
> As long as the gxp.plugins.LayerTre has a property "groups" that is
> default setted to null,
> (see the file /var/www/geonode/static/geoexplorer/GeoExplorer.js 80302 )
>
> I've found this way to overwrite it and set my custom groups:
>  in the map templates dir I've created different templates
>
> /usr/local/lib/python2.7/dist-packages/geonode/maps/templates/maps
>
> map_view.html
> map_geoexplorer.js
>
> (original)
>
> map_view_company.html
> map_geoexplorer_company.js
>
> (custom)
> where  map_view_company.html has only the different script line:
>
> {% include 'maps/map_geoexplorer_company.js' %}
>
>
> and in map_geoexplorer_company.js the code to load custom groups
>
> <script type="text/javascript">
> /* modifica amedeo 27/07/16
>  * vengono definiti i layergroup per le mappe di tipo "Abaco"
>   */
>  gxp.plugins.LayerTree.prototype.groups = {
>
>                 "agen": "Agenzie",
>                 "come":{
>                     title: "Commesse",
>                     exclusive: true
>                                 },
>                   "comp": "Competitors",
>                   "mark": "Commerciali",
>                   "default": "Utilità", // title can be
> overridden with overlayNodeText
>                 "background": {
>                     title: "Sfondi", // can be overridden with baseNodeText
>                     exclusive: true
>                 }
>             };
>  </script>
>
>
> Each group is defined in the form "name": "Title" or can have another
> property "exclusive": true for radio button group.
>
> see http://gxp.opengeo.org/master/doc/lib/plugins/LayerTree.html
>
> Now I'm wondering what's the better  way to call differnte templates
> based on map name or map id,
> I've added a dictionary { "mapid": "templatename"} in
> local_settings.py and by now I've customized the
> geonode.maps.view.map_view to parse that dictionary, but I'm pretty
> sure that the template can be used as an argument of that function so
> I can parse the dictionary in geonode.urls.py.
>
>
> Any comments or suggestions are appreciated.
>
> Amedeo Fadini
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geonode-users
>



-- 
Simone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20160802/41878881/attachment.html>


More information about the geonode-users mailing list