[GeoNode-users] Problems with creating maps from script

John, Steffen s.john at atenekom.eu
Mon Feb 6 04:51:34 PST 2017


Hi!

I'm trying to automatically create a map from given layernames.

To do so, I've created a management command and put it under geonode/maps/management/commands/createmapfromlayers.py

the code looks as follows (only important lines):
def handle(self, *args, **options):
from geonode.layers.models import Layer
from geonode.maps.models import Map, MapLayer
for l in options.get('layers').split(','):
    layers.append(Layer.objects.get(typename=l))

m = Map()
m.create_from_layer_list(user, layers, title, abstract)
m.save()


The Result is,  that a map is created. Also the layers are added at least to table in the relation maps_maplayer, but are not shown in the map.

In the relation map_maplayer, the attribute for ows_url, layer_params and source params are missing.

>From the geoserver log (see at the end of the mail), I can see that the layer is not found, but the request shown from the geoserver DEBUG output seems to be correct.

Do you have any Idea, of what I'm doing wrong?

Or are there any alternative ways to programatically create maps?

Thanks in Advance!

Cheers,
Steffen

geoserver.log (shortened stack trace )



06 Feb 11:02:15 DEBUG [org.geoserver.security] - AuthenticationCache has no entry for basic, admin:c2af47d79129047bda3f8a97a1f68464
06 Feb 11:02:15 DEBUG [org.geoserver.security.rememberme.GeoServerTokenBasedRememberMeServices] - Did not send remember-me cookie (principal did not set parameter '_spring_security_remember_me')
06 Feb 11:02:15 DEBUG [org.geoserver.security.rememberme.GeoServerTokenBasedRememberMeServices] - Remember-me login not requested.
06 Feb 11:02:15 DEBUG [org.geoserver.security] - AuthenticationCache adding new entry for basic, admin:c2af47d79129047bda3f8a97a1f68464
06 Feb 11:02:15 DEBUG [org.geoserver.security] - Cache entries #: 0
06 Feb 11:02:15 DEBUG [org.geoserver.security] - AuthenticationCache added new entry for basic, admin:c2af47d79129047bda3f8a97a1f68464
06 Feb 11:02:15 DEBUG [org.geoserver.security] - Cache entries #: 1
06 Feb 11:02:15 DEBUG [org.geoserver.security.RESTfulPathBasedFilterInvocationDefinitionMap] - Converted URL to lowercase, from: '/rest/layers/geonode:punktwolke.xml'; to: '/rest/layers/geonode:punktwolke.xml'  and httpMethod= GET
06 Feb 11:02:15 DEBUG [org.geoserver.security.RESTfulPathBasedFilterInvocationDefinitionMap] - ~~~~~~~~~~ antPath= /rest/process/batchdownload/download/* methodList= [GET]
06 Feb 11:02:15 DEBUG [org.geoserver.security.RESTfulPathBasedFilterInvocationDefinitionMap] - Candidate is: '/rest/layers/geonode:punktwolke.xml'; antPath is /rest/process/batchdownload/download/*; matchedPath=false; matchedMethods=true
06 Feb 11:02:15 DEBUG [org.geoserver.security.RESTfulPathBasedFilterInvocationDefinitionMap] - ~~~~~~~~~~ antPath= /** methodList= [GET]
06 Feb 11:02:15 DEBUG [org.geoserver.security.RESTfulPathBasedFilterInvocationDefinitionMap] - Candidate is: '/rest/layers/geonode:punktwolke.xml'; antPath is /**; matchedPath=true; matchedMethods=true
06 Feb 11:02:15 DEBUG [org.geoserver.security.RESTfulPathBasedFilterInvocationDefinitionMap] - returning ROLE_ADMINISTRATOR
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/rest/layers/geonode:punktwolke.xml]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/rest/layers/geonode:punktwolke.xml]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/rest/layers/geonode:punktwolke.xml]
06 Feb 11:02:15 DEBUG [org.geoserver] - Thread 40 locking in mode READ
06 Feb 11:02:15 DEBUG [org.geoserver] - Thread 40 got the lock in mode READ
06 Feb 11:02:15 DEBUG [org.geoserver] - Thread 40 releasing the lock in mode READ
06 Feb 11:02:15 DEBUG [org.geoserver.filters] - Compressing output for mimetype: application/xml
06 Feb 11:02:15 DEBUG [org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1] - SecurityContextHolder now cleared, as request processing completed
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - Matching patterns for request [/wms/reflect] are [/wms/*]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - URI Template variables for request [/wms/reflect] are {}
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - Mapping [/wms/reflect] to HandlerExecutionChain with handler [org.geoserver.ows.Dispatcher at 3892d911] and 1 interceptor
06 Feb 11:02:15 INFO [org.geoserver.wms] -
Request: getServiceInfo
06 Feb 11:02:15 ERROR [org.geoserver.ows] -
org.geoserver.platform.ServiceException: Could not find layer geonode:punktwolke
    at org.geoserver.wms.map.GetMapKvpRequestReader.parseLayers(GetMapKvpRequestReader.java:1325)
    at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:231)
    ...
06 Feb 11:02:15 DEBUG [org.geoserver.filters] - Compressing output for mimetype: text/xml;charset=UTF-8
06 Feb 11:02:15 DEBUG [org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1] - SecurityContextHolder now cleared, as request processing completed
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - No handler mapping found for [/wms/reflect]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - Matching patterns for request [/wms/reflect] are [/wms/*]
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - URI Template variables for request [/wms/reflect] are {}
06 Feb 11:02:15 DEBUG [org.geoserver.ows.OWSHandlerMapping] - Mapping [/wms/reflect] to HandlerExecutionChain with handler [org.geoserver.ows.Dispatcher at 3892d911] and 1 interceptor
06 Feb 11:02:15 INFO [org.geoserver.wms] -
Request: getServiceInfo
06 Feb 11:02:15 ERROR [org.geoserver.ows] -
org.geoserver.platform.ServiceException: Could not find layer geonode:punktwolke
    at org.geoserver.wms.map.GetMapKvpRequestReader.parseLayers(GetMapKvpRequestReader.java:1325)
    at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:231)
    ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20170206/30920510/attachment.html>


More information about the geonode-users mailing list