<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body class="" style="word-wrap:break-word; line-break:after-white-space" fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hello Toni,<br>
<br>
thank you for your help, this was already quite useful.<br>
Maybe you can also help with a follow-up question:<br>
<br>
I created a new map using the way you pointed out and the map is visible in the Geonode maps overview.<br>
But when I try to view the map, the layers are unfortunately not visible to the user (who created the map). All layers are also owned by the same user.<br>
To check for general errors on the system, I created a map manually with the same layers using the Mapstore GUI and this map is displayed without a problem.<br>
I was unfortunately also not able to spot any error messages on the server or client, which hint to a problem with the map.<br>
<br>
Any hints are appreciated,<br>
Carsten<br>
<br>
-- <br>
Carsten Stemmler<br>
- Research & Development<br>
<br>
E F T A S    Fernerkundung<br>
Technologietransfer GmbH<br>
Oststraße 2-18<br>
48145 Münster<br>
Fon: +49 251 13307-0      E-Mail: carsten.stemmler@eftas.com<br>
Fax: +49 251 13307-33     Web:   http://www.eftas.com<br>
Geschäftsführer:<br>
Dipl.-Ing. Georg Altrogge<br>
<br>
Sitz der Gesellschaft: Münster<br>
Amtsgericht Münster, HRB 2999<br>
USt.-IdNr. DE 126038986
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF390374" style="direction: ltr;"><font size="2" face="Tahoma" color="#000000"><b>Von:</b> Toni Schönbuchner [toni.schoenbuchner@csgis.de]<br>
<b>Gesendet:</b> Montag, 9. September 2019 20:14<br>
<b>An:</b> EFTAS Carsten Stemmler<br>
<b>Cc:</b> geonode-devel-owner@lists.osgeo.org<br>
<b>Betreff:</b> Re: Programmatically create layers and maps from own Django App<br>
</font><br>
</div>
<div></div>
<div>Hi Carsten,
<div class=""><br class="">
</div>
<div class="">in case you have generated files on your disk maybe it could be enough to just use importlayers?</div>
<div class="">Have a look how it's done here: <a href="https://github.com/GeoNode/geonode/blob/master/pavement.py#L1002" class="" target="_blank" rel="noopener noreferrer">https://github.com/GeoNode/geonode/blob/master/pavement.py#L1002</a></div>
<div class=""><br class="">
</div>
<div class="">For map creation I would go with something like:</div>
<div class=""><br class="">
</div>
<div class="">$ python manage.py shell</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">from geonode.layers.models import Layer</div>
<div class="">from geonode.maps.models import Map</div>
<div class="">from geonode.people.models import Profile</div>
<div class=""><br class="">
</div>
<div class="">user = Profile.objects.get(id=1000)</div>
<div class="">m = Map()</div>
<div class="">layer_name = Layer.objects.all().first().alternate</div>
<div class="">m.create_from_layer_list(user, [layer_name], "title", "abstract")</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">In this case 1000 is the ID of my admin user. You would pass your newly imported layers to </div>
<div class="">m.create_from_layer_list()</div>
<div class=""><br class="">
</div>
<div class="">cheers,</div>
<div class=""><br class="">
</div>
<div class="">Toni</div>
<div class=""><br class="">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">Am 09.09.2019 um 12:13 schrieb <a href="mailto:geonode-devel-owner@lists.osgeo.org" class="" target="_blank" rel="noopener noreferrer">
geonode-devel-owner@lists.osgeo.org</a>:</div>
<br class="Apple-interchange-newline">
<div class=""><span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">As
 list administrator, your authorization is requested for the</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">following
 mailing list posting:</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">   List:
    </span><a href="mailto:geonode-devel@lists.osgeo.org" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" target="_blank" rel="noopener noreferrer">geonode-devel@lists.osgeo.org</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">   From:
    </span><a href="mailto:carsten.stemmler@eftas.com" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" target="_blank" rel="noopener noreferrer">carsten.stemmler@eftas.com</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">   Subject:
 Programmatically create layers and maps from own Django App</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">   Reason:
  Post to moderated list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">At
 your convenience, visit:</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">   </span><a href="https://lists.osgeo.org/mailman/admindb/geonode-devel" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/admindb/geonode-devel</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">to
 approve or deny the request.</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; margin:0px">
<span class="" style="color:rgb(127,127,127)"><b class="">Von:<span class="Apple-converted-space"> </span></b></span><span class="" style="">EFTAS Carsten Stemmler <<a href="mailto:carsten.stemmler@eftas.com" class="" target="_blank" rel="noopener noreferrer">carsten.stemmler@eftas.com</a>><br class="">
</span></div>
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; margin:0px">
<span class="" style="color:rgb(127,127,127)"><b class="">Betreff:<span class="Apple-converted-space"> </span></b></span><span class="" style=""><b class="">Programmatically create layers and maps from own Django App</b><br class="">
</span></div>
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; margin:0px">
<span class="" style="color:rgb(127,127,127)"><b class="">Datum:<span class="Apple-converted-space"> </span></b></span><span class="" style="">9. September 2019 um 11:39:39 MESZ<br class="">
</span></div>
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; margin:0px">
<span class="" style="color:rgb(127,127,127)"><b class="">An:<span class="Apple-converted-space"> </span></b></span><span class="" style="">"<a href="mailto:geonode-devel@lists.osgeo.org" class="" target="_blank" rel="noopener noreferrer">geonode-devel@lists.osgeo.org</a>"
 <<a href="mailto:geonode-devel@lists.osgeo.org" class="" target="_blank" rel="noopener noreferrer">geonode-devel@lists.osgeo.org</a>><br class="">
</span></div>
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; direction:ltr; font-family:Tahoma; font-size:10pt">
Dear all,<br class="">
<br class="">
I created a new Django App by using geonode-project (Geonode version 2.10) to do some geospatial processing.<br class="">
As a result of this process I want to create a new layer (and furthermore a map) within Geonode without user interaction.<span class="Apple-converted-space"> </span><br class="">
<br class="">
I already had a look at the documentation, however I'm not sure about the right way to accomplish this task. Can I use internal functions e.g. from<span class="" style="color:rgb(197,134,192)"><span class="Apple-converted-space"> </span></span><font class=""><i class="">geonode.layers.models<span class="Apple-converted-space"> </span></i>or
 is it necessary to use the Geoserver Rest API to import the data there directly (or another way I am not aware of at the moment)?<br class="">
<br class="">
Any hints and also specific links to the documentation are appreciated.<br class="">
Carsten<br class="">
<br class="">
--<span class="Apple-converted-space"> </span><br class="">
Carsten Stemmler<br class="">
- Research & Development<br class="">
<br class="">
E F T A S    Fernerkundung<br class="">
Technologietransfer GmbH<br class="">
Oststraße 2-18<br class="">
48145 Münster<br class="">
Fon: +49 251 13307-0      E-Mail:<span class="Apple-converted-space"> </span><a href="mailto:carsten.stemmler@eftas.com" class="" target="_blank" rel="noopener noreferrer">carsten.stemmler@eftas.com</a><br class="">
Fax: +49 251 13307-33     Web:  <span class="Apple-converted-space"> </span><a href="http://www.eftas.com/" class="" target="_blank" rel="noopener noreferrer">http://www.eftas.com</a><br class="">
Geschäftsführer:<br class="">
Dipl.-Ing. Georg Altrogge<br class="">
<br class="">
Sitz der Gesellschaft: Münster<br class="">
Amtsgericht Münster, HRB 2999<br class="">
USt.-IdNr. DE 126038986<br class="">
<i class=""></i></font></div>
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; margin:0px">
<span class="" style="color:rgb(127,127,127)"><b class="">Von:<span class="Apple-converted-space"> </span></b></span><span class="" style=""><a href="mailto:geonode-devel-request@lists.osgeo.org" class="" target="_blank" rel="noopener noreferrer">geonode-devel-request@lists.osgeo.org</a><br class="">
</span></div>
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; margin:0px">
<span class="" style="color:rgb(127,127,127)"><b class="">Betreff:<span class="Apple-converted-space"> </span></b></span><span class="" style=""><b class="">confirm 61cb4ec0107fc608b6f30c51a47cea3e31831aea</b><br class="">
</span></div>
<div class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; margin:0px">
<span class="" style="color:rgb(127,127,127)"><b class="">Datum:<span class="Apple-converted-space"> </span></b></span><span class="" style="">9. September 2019 um 12:13:03 MESZ<br class="">
</span></div>
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">If
 you reply to this message, keeping the Subject: header intact,</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">Mailman
 will discard the held message.  Do this if the message is</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">spam.
  If you reply to this message and include an Approved: header</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">with
 the list password in it, the message will be approved for posting</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">to
 the list.  The Approved: header can also appear in the first line</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">of
 the body of the reply.</span></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>