I seem to have mislead you - gsconfig is able to create layers only
indirectly (by adding a CoverageStore or DataStore and allowing GeoServer
to automatically configure a layer from it.)  The good news is that the
GeoServer REST API itself does support creating new layers directly, but
since gsconfig doesn't yet support this operation it will take some coding
work to do it.  You could use a different tool (some alternatives are
listed at
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-examples/index.html)
or, since you've already spent some time digging into the code, maybe
you
could help add this feature to gsconfig.  In case you are interested in
this, I've included some notes on how to go about it in the rest of this
email.  You can also contact me via IRC chat at the #geoserver channel on
Freenode if you have further questions.
http://webchat.freenode.net/?channels=#geoserver will let you connect to
this chat in a web browser.)

gsconfig is designed to use an Unsaved variant of any REST resource type
for resources that are being created directly - so in order to create
layers without relying on auto-configuration we would need to have those.
 The general pattern is to add a method on the Catalog class which creates
the thing and takes as parameters any required fields, and returns a new
UnsavedThing.  For example, see the create_datastore method in the Catalog
class:

def create_datastore(self, name, workspace=None):

    if isinstance(workspace, basestring):
        workspace = self.get_workspace(workspace)
    elif workspace is None:
        workspace = self.get_default_workspace()
    return UnsavedDataStore(self, name, workspace)

UnsavedDataStore is a very small class which extends DataStore and
overrides its "save_method" field to POST instead of PUT and ensures that
all required fields are marked as "dirty" (ie, will be included in the REST
request that is generated.)  Similar variants would be required for Layer
and Coverage in order to configure new raster layers - both will closely
follow the design of DataStore.

--
David Winslow
OpenGeo - http://opengeo.org/


On Mon, Dec 10, 2012 at 9:35 AM, Katie Essadro <[email protected]>wrote:

> Hello list,
>
> I have been looking over the gsconfig.py code for days, and I just do not
> see any function that can create a layer. The author of the program said
> though that it is possible to create layers. Does anyone know what function
> to use to create a layer?
>
> Thanks!
> Katie
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to