<div dir="ltr">Thank

you  very much !It is so helpful.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 28, 2019 at 11:00 PM <<a href="mailto:geonode-users-request@lists.osgeo.org">geonode-users-request@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send geonode-users mailing list submissions to<br>
        <a href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.osgeo.org/mailman/listinfo/geonode-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geonode-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:geonode-users-request@lists.osgeo.org" target="_blank">geonode-users-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:geonode-users-owner@lists.osgeo.org" target="_blank">geonode-users-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of geonode-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Programmatically create a map (Sam Franklin)<br>
   2. GWC doesn't work normaly for GeoExt client on docker Geonode<br>
      2.10 master (Dejan Samardzic)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Mon, 28 Jan 2019 15:36:55 +0000<br>
From: Sam Franklin <<a href="mailto:mr.samfranklin@gmail.com" target="_blank">mr.samfranklin@gmail.com</a>><br>
To: <a href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a><br>
Subject: [GeoNode-users] Programmatically create a map<br>
Message-ID:<br>
        <CAPYJVm3kzLgzX7XG=-4PEHk=<a href="mailto:ER5uavJMRJGih8HsfzHD9GTTdA@mail.gmail.com" target="_blank">ER5uavJMRJGih8HsfzHD9GTTdA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi List<br>
<br>
I would like to programmatically create a map that consists of my base<br>
layers (all configured in settings.py) and an existing layer that I've<br>
added to geonode.<br>
<br>
So, I have a workaround solution to do this using the manage.py<br>
dumpdata/loaddata commands. I've created my content manually, then dumped<br>
out the model configuration to JSON. Then cleaned my environment, i.e.<br>
deleted all the content, and then run ./manage.py loaddata config.json.<br>
This works, but it is not particularly robust as there are hardcoded<br>
primary key values for maps and layers in the JSON config.<br>
<br>
I think it might be preferable to use the geonode python package. I saw<br>
that there's a method 'create_from_layer_list' in /maps/models.py. I think<br>
this is what I want, so I wrote a short custom management command to import<br>
the maps model and call this method:<br>
<br>
>>>><br>
<br>
from django.core.management.base import BaseCommand, CommandError<br>
from django.contrib.auth import get_user_model<br>
from geonode.maps.models import Map<br>
from geonode.layers.models import Layer<br>
<br>
class Command(BaseCommand):<br>
    def handle(self, *args, **kwargs):<br>
        m = Map()<br>
        layer_name = Layer.objects.all().first().alternate<br>
        admin_user = get_user_model().objects.get(username='admin')<br>
        m.create_from_layer_list(admin_user, [layer_name], "test_map",<br>
"this is a map")<br>
<br>
>>>><br>
<br>
This custom command created a map object but is missing any of my base<br>
layers, so the map doesn't render any content.<br>
<br>
Within the management command, I need to add the base layers as well, but<br>
am not sure of what to try next to solve this.<br>
<br>
Is the "create_from_layer_list" method the best way to go, or is there a<br>
better way to programmatically generate a map based on a list of layers<br>
(other than my dumpdata/loaddata approach).<br>
<br>
Thanks in advance for any advice.<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.osgeo.org/pipermail/geonode-users/attachments/20190128/53a19c76/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.osgeo.org/pipermail/geonode-users/attachments/20190128/53a19c76/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Mon, 28 Jan 2019 15:03:21 +0000<br>
From: Dejan Samardzic <<a href="mailto:dejan.samardzic@cedis.me" target="_blank">dejan.samardzic@cedis.me</a>><br>
To: "<a href="mailto:geonode-users-request@lists.osgeo.org" target="_blank">geonode-users-request@lists.osgeo.org</a>"<br>
        <<a href="mailto:geonode-users-request@lists.osgeo.org" target="_blank">geonode-users-request@lists.osgeo.org</a>>,<br>
        "<a href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a>" <<a href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a>><br>
Subject: [GeoNode-users] GWC doesn't work normaly for GeoExt client on<br>
        docker Geonode 2.10 master<br>
Message-ID: <<a href="mailto:44261616a23049a7af2291161bce0285@cedis.me" target="_blank">44261616a23049a7af2291161bce0285@cedis.me</a>><br>
Content-Type: text/plain; charset="iso-8859-2"<br>
<br>
Dear Geonode community,<br>
<br>
We have made docker Gonode 2.10 master branch installation on Ubuntu 18.04 by Alessio's guide:<br>
<br>
<a href="https://docs.google.com/document/d/1S0ac9IR9IW9tUjMu7JETPLUjnfQ6P87m1PKNko8IPWY/edit" rel="noreferrer" target="_blank">https://docs.google.com/document/d/1S0ac9IR9IW9tUjMu7JETPLUjnfQ6P87m1PKNko8IPWY/edit</a><br>
<br>
after that we have configure GeoWebCache:<br>
1) We have configure Caching to external postgresql database:<br>
Tile caching - Disk quota....Enable disk Quota ....Maximum tile cache size 50GiB<br>
Disk quota check frequency:600s<br>
Disk quota store type....External database<br>
Target database type....PostgreSQL<br>
JDBC data source...GeoServer managed connection pool<br>
JDBC Driver class name.....org.postgresql.Driver<br>
JDBC connection URL.....jdbc:postgresql://db:5432/geonode<br>
User name.....geonode<br>
Password.....****<br>
Validation query.....select 1<br>
<br>
2) Define path for cache<br>
>From geoserver container:<br>
mkdir /var/cache/geoserver<br>
chmod -R 777 geoserver<br>
vi /usr/local/tomcat/webapps/geoserver/WEB-INF/web.xml<br>
insert :<br>
<context-param><br>
       <param-name>GEOWEBCACHE_CACHE_DIR</param-name><br>
       <param-value>/var/cache/geoserver/</param-value><br>
</context-param><br>
<br>
Now, GeoWebCache doesn't work (geowebcache-cache-result is always MISS and system is not generating png files in GEOWEBCACHE_CACHE_DIR).<br>
We have to remove/add that specitic layer in Geoserver->Tile Caching->Tile Layers. After that, GWC start working normally (geowebcache-cache-result is HIT and system start generating png files in GEOWEBCACHE_CACHE_DIR).<br>
Let me underline that before and after this remove/add actions, url on browser's Developer Tool has the same structure like:<br>
<a href="http://testgis.cedis.me/geoserver/ows?access_token=pNPeKSZxG60GgtYcUJ97RCMKKGuIXm&LAYERS=geonode%3Anovi_r5_Grbalj_3_10kV_izmjenjen&FORMAT=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&TILED=true&SRS=EPSG%3A3857&BBOX=2088259.6124603,5217897.2981329,2088565.3605734,5218203.046246&WIDTH=256&HEIGHT=256" rel="noreferrer" target="_blank">http://testgis.cedis.me/geoserver/ows?access_token=pNPeKSZxG60GgtYcUJ97RCMKKGuIXm&LAYERS=geonode%3Anovi_r5_Grbalj_3_10kV_izmjenjen&FORMAT=image%2Fpng&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&TILED=true&SRS=EPSG%3A3857&BBOX=2088259.6124603,5217897.2981329,2088565.3605734,5218203.046246&WIDTH=256&HEIGHT=256</a><br>
<br>
Please watch for yourself:<br>
<a href="https://www.youtube.com/watch?v=4Y0KIBOowDM" rel="noreferrer" target="_blank">https://www.youtube.com/watch?v=4Y0KIBOowDM</a><br>
<br>
Regards,<br>
Dejan.<br>
--<br>
<br>
<br>
<br>
 Dejan Samardžić        Rukovodilac Sektora za ICT / IT Manager<br>
<br>
[<a href="mailto:cid%3Apart1.024E2240.9C760C1E@cedis.me" target="_blank">cid:part1.024E2240.9C760C1E@cedis.me</a>]<br>
CEDIS d.o.o.<br>
Ivana Milutinovića 12, 81000 Podgorica<br>
gsm:    +382 67 220 971<br>
tel:    +382 20 408 453<br>
email:  <a href="mailto:dejan.samardzic@cedis.me" target="_blank">dejan.samardzic@cedis.me</a><mailto:<a href="mailto:dejan.samardzic@cedis.me" target="_blank">dejan.samardzic@cedis.me</a>><br>
web:    <a href="http://www.cedis.me" rel="noreferrer" target="_blank">www.cedis.me</a><<a href="http://www.cedis.me" rel="noreferrer" target="_blank">http://www.cedis.me</a>><br>
<br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.osgeo.org/pipermail/geonode-users/attachments/20190128/22144a69/attachment-0001.html" rel="noreferrer" target="_blank">http://lists.osgeo.org/pipermail/geonode-users/attachments/20190128/22144a69/attachment-0001.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: image001.jpg<br>
Type: image/jpeg<br>
Size: 1641 bytes<br>
Desc: image001.jpg<br>
URL: <<a href="http://lists.osgeo.org/pipermail/geonode-users/attachments/20190128/22144a69/attachment-0001.jpg" rel="noreferrer" target="_blank">http://lists.osgeo.org/pipermail/geonode-users/attachments/20190128/22144a69/attachment-0001.jpg</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
geonode-users mailing list<br>
<a href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/geonode-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geonode-users</a><br>
<br>
<br>
------------------------------<br>
<br>
End of geonode-users Digest, Vol 48, Issue 39<br>
*********************************************<br>
</blockquote></div>