[GeoNode-devel] [GeoNode-users] MapStore/GeoNode: Pass the sources object of the map to the settings

Stefano Bovio stefano.bovio at geosolutionsgroup.com
Mon Jun 28 02:43:42 PDT 2021


Dear Julierme, Alessio

According to
> https://mapstore.readthedocs.io/en/latest/developer-guide/maps-configuration/#wmts,
> we have some Map Options: projection, zoom, layers, units, center, etc.
> Some of these Map Options / variables are available in the settings.py (
> https://github.com/GeoNode/geonode/blob/master/geonode/settings.py#L1398,L1403).
> To which file these variables are passed? The reason I am asking is because
> I can try to pass the MAP 's source object straight in this file.



The following steps describes how the map object is injected in the
template of a map/layer viewer of GeoNode version 3.2.x:
- the template initializes the context using the
ms2_config_converter.convert
https://github.com/GeoNode/geonode-mapstore-client/blob/2.1.x/geonode_mapstore_client/hooksets.py#L162-L164
- the ms2_config_converter.convert function creates the map configuration
that uses the settings such as MAP_BASELAYERS, CATALOGUE_SERVICES and
CATALOGUE_SELECTED_SERVICE
https://github.com/GeoNode/geonode-mapstore-client/blob/2.1.x/mapstore2_adapter/plugins/geonode.py#L107
- the client read the configuration from the window.__GEONODE_CONFIG__
object accessible at window level where the resourceConfig represent the
map configuration (similar to the new.json). The __GEONODE_CONFIG__ is
defined in the _geonode_config.html template file
https://github.com/GeoNode/geonode-mapstore-client/blob/2.1.x/geonode_mapstore_client/templates/geonode-mapstore-client/_geonode_config.html#L19

So the window.__GEONODE_CONFIG__.resourceConfig represents the map
configuration used by the client and it seems that the
geonode-mapstore-client converter does not support the concept of
map['sources'] and maybe this part could be extended and added to the
setting.py + geonode/mapstore map converter to allow this addition.

I was thinking on the possibility to propose an override client side of the
sources configuration by extending the  _geonode_config.html template,
something like:

{% extends 'geonode-mapstore-client/_geonode_config.html' %}
{% block override_local_config %}
<script>
    // check if the map configuration exist
    if (window.__GEONODE_CONFIG__ &&
window.__GEONODE_CONFIG__.resourceConfig &&
window.__GEONODE_CONFIG__.resourceConfig.map) {
        // add a static sources configuration client side
        window.__GEONODE_CONFIG__.resourceConfig.map.sources = { /* sources
configuration */ }
    }
</script>
{% endblock %}

but I'm worried that this approach could break the saving and retrieving
process of a map configuration due the fact that map['sources'] is not
currently supported in the serializer/converter of the
geonode-mapstore-client.
I just opened an issue to investigate on this enhancement for the future
releases:

https://github.com/GeoNode/geonode-mapstore-client/issues/280

Hope this help,
Kind Regards,

Stefano


On Fri, Jun 25, 2021 at 4:50 PM 1520 gis <
juliermeopensourcedeveloper at gmail.com> wrote:

> Dear Alessio,
>
> Thank you very much for your reply.
> According to
> https://mapstore.readthedocs.io/en/latest/developer-guide/maps-configuration/#wmts,
> we have some Map Options: projection, zoom, layers, units, center, etc.
> Some of these Map Options / variables are available in the settings.py (
> https://github.com/GeoNode/geonode/blob/master/geonode/settings.py#L1398,L1403).
> To which file these variables are passed? The reason I am asking is because
> I can try to pass the MAP 's source object straight in this file.
>
> Thank you very much for your time in advance
>
> Kind regards
>
> Julierme
>
>
>
> On Fri, Jun 25, 2021 at 10:45 AM Alessio Fabiani <
> alessio.fabiani at geo-solutions.it> wrote:
>
>> @Stefano Bovio <stefano.bovio at geo-solutions.it> any idea?
>>
>> Il giorno ven 25 giu 2021 alle ore 13:41 1520 gis <
>> juliermeopensourcedeveloper at gmail.com> ha scritto:
>>
>>> Hill all, I got to load a WMTS Basemap Layer in MapStore/Core following
>>> https://mapstore.readthedocs.io/en/latest/developer-guide/maps-configuration/#wmts.
>>> WMTS Layer requires a source object in the sources object of the map
>>> configuration where to retrieve the tileMatrixSet. Everything is working
>>> smoothly in MapStore/Core. Now, could anyone point me on how to pass the
>>> sources object of the map in GeoNode settings.py? Any direction will be
>>> very appreciated.
>>>
>>> Thank you for your time in advance
>>>
>>> Kind regards
>>>
>>> Julierme
>>> _______________________________________________
>>> geonode-users mailing list
>>> geonode-users at lists.osgeo.org
>>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>>
>>
>>
>> --
>>
>> ==
>>
>> GeoServer Professional Services from the experts! Visit
>> http://goo.gl/it488V for more information.
>> ==
>> Ing. Alessio Fabiani
>>
>> @alfa7691
>> Founder/Technical Lead
>>
>>
>> GeoSolutions S.A.S.
>> Via di Montramito 3/A - 55054  Massarosa (LU) - Italy
>> phone: +39 0584 962313
>> fax:     +39 0584 1660272
>> mob:   +39 331 6233686
>>
>>
>> http://www.geo-solutions.it
>> http://twitter.com/geosolutions_it
>> -------------------------------------------------------
>>
>> Con riferimento alla normativa sul trattamento dei dati personali (Reg.
>> UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
>> precisa che ogni circostanza inerente alla presente email (il suo
>> contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
>> riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
>> messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
>> operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
>>
>>
>> This email is intended only for the person or entity to which it is
>> addressed and may contain information that is privileged, confidential or
>> otherwise protected from disclosure. We remind that - as provided by
>> European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
>> e-mail or the information herein by anyone other than the intended
>> recipient is prohibited. If you have received this email by mistake, please
>> notify us immediately by telephone or e-mail.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20210628/6fbc38c8/attachment.html>


More information about the geonode-devel mailing list