[GeoNode-users] MapStore2 Viewer - Custom WMTS background map

Alessio Fabiani alessio.fabiani at geo-solutions.it
Fri Apr 26 05:20:16 PDT 2019


Hello Pascal,
well, unfortunately at this time this is not quite easy to achieve in
MapStore2.

There are plans to introduce a generic "TMS" Provider in the next release,
but at this time only configured providers are supported. See the list here

https://mapstore.readthedocs.io/en/latest/developer-guide/maps-configuration/#providers-and-variants


In order to add your own provider, you should roughly follow those steps:

1) download the geonode-mapstore-client source code

git clone https://github.com/geosolutions-it/geonode-mapstore-client.git

2) go to folder geonode-mapstore-client/geonode_mapstore_client/client and
run

git submodule update --recursive

3) edit the file ConfigProvider.js and add your new provider

vim MapStore2/web/client/utils/ConfigProvider.js

4) rebuild the library; from
geonode-mapstore-client/geonode_mapstore_client/client

npm run compile

5) install your local version of the python library; from
geonode-mapstore-client

pip install -e .

6) go back to geonode source folder and run

python manage.py collectstatic

7) restart the server after having updated the MS2_DEFAULT_BACKGROUNDs
config accordingly

Hope this helps.

By the way, the same procedure applies whenever you would like to
update/customize MapStore2 somehow.

Regards,
Alessio.




Il giorno ven 26 apr 2019 alle ore 12:01 Pascal Coulon <
Pascal.Coulon at scisys.co.uk> ha scritto:

> All,
>
>
>
> We have decided to use MapStore2 as the main viewer in Geonode (2.10RC4).
> We would like to set-up a custom WMTS or XYZ (tile) layer for the
> background map. We are based in the UK and we would need to use the
> Ordnance Survey OGC feed for this.
>
>
>
> In our settings.py we have set-up the following config.
>
>
>
> DEFAULT_MAP_CRS = "EPSG:3857"
>
>
>
> if 'geonode_mapstore_client' not in INSTALLED_APPS:
>
>     INSTALLED_APPS += (
>
>         'mapstore2_adapter',
>
>         'geonode_mapstore_client',)
>
> GEONODE_CLIENT_LAYER_PREVIEW_LIBRARY = 'mapstore'  # DEPRECATED use
> HOOKSET instead
>
> GEONODE_CLIENT_HOOKSET = "geonode_mapstore_client.hooksets.MapStoreHookSet"
>
> MAPSTORE_DEBUG = False
>
>
>
> ### The key to access OS API as obfuscated. #####
>
> DEFAULT_MS2_BACKGROUNDS = [
>
>
>
>          {
>
>              "type":"wmts",
>
>              "title":"Ordnance Survey",
>
>               "allowedSRS": {
>
>               "EPSG:3857": True
>
>               },
>
>              "url": [
>
>               "
> https://api2.ordnancesurvey.co.uk/mapping_api/v1/service/zxy/EPSG:3857/Outdoor
> 3857/${z}/${x}/${y}.png?key=xxxxx"
>
>              ],
>
>              "visibility": False,
>
>              "group":"background",
>
>               "matrixIds": [
>
>                   "EPSG:3857",
>
>               ],
>
>               "tileMatrixSet": [
>
>                  ],
>
>              "capabilitiesURL": "
> https://api2.ordnancesurvey.co.uk/mapping_api/v1/service/wmts?Request=GetCapabilities&key=XXXXXXXXXXXX
> "
>
>         },
>
>
>
>
>
>     ]
>
>
>
> MAPSTORE_BASELAYERS = DEFAULT_MS2_BACKGROUNDS
>
>
>
> The background data from OS does not get properly set and we get some
> JavaScript errors that lead us to believe that we are not setting the
> background layer the proper way.
>
>
>
> Any help or recommendation would be gratefully received.
>
>
>
> Regards,
>
>
>
> Pascal
>
>
>
> <http://gfidisc.scisys.co.uk>
>
>
> SCISYS UK Limited. Registered in England and Wales No. 4373530.
> Registered Office: Methuen Park, Chippenham, Wiltshire SN14 0GB, UK.
>
> Before printing, please think about the environment.
>
> <http://gfidisc.scisys.co.uk>
> _______________________________________________
> 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-users/attachments/20190426/b1ce71ac/attachment-0001.html>


More information about the geonode-users mailing list