[Geoserver-users] gsconfig.py help needed

Hi Katie,

In general it’s good to keep discussion about tools like gsconfig.py on public fora - someone else on the GeoServer users list may also know something about your problem!

I haven’t used image pyramids in gsconfig before, but I expect it will work fine. In general, when investigating new operations for gsconfig I prepare a layer as desired in the GeoServer WEB UI and then inspect it using the REST API in curl, a browser, or gsconfig itself.

I also don’t often test on Windows, so I don’t know what the problem may be. Perhaps the way you have installed gsconfig has modified the source code in some way; for example, git may be altering the line endings during checkout. I am aware of some successful gsconfig users on Windows so I’m sure this issue can be resolved with a little research.

···

On Tue, Dec 4, 2012 at 11:01 AM, Katie Essadro <katieessadro@anonymised.com…84…> wrote:

Hello David,

I was told that you may be able to help me.

I am trying to use gsconfig.py to create an ImagePyramid store and layer with Geoserver. But, I am having problems even installing this on Windows:

C:\Users\katie\Desktop\giscode\gsconfig.py-master>setup.py install
File “C:\Users\katie\Desktop\giscode\gsconfig.py-master\setup.py”, line 8
except IOError,e:
^
SyntaxError: invalid syntax

Any idea what I am doing wrong?

Beyond that, can I use gsconfig.py to create an ImagePyramid store in Geoserver?

Thanks!

Katie

Can gsconfig.py be used to automatically add a store and layer into
Geoserver, or do I need to do that first manually?

Is there anyway to automatically create a store and layer through the API?

Thanks!
Katie

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021208.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Yes, gsconfig can automatically create layers, layergroups, (vector and raster) resources, datastores, coveragestores, styles, and workspaces. Have you seen the examples at https://github.com/dwins/gsconfig.py/tree/master/examples and https://github.com/dwins/gsconfig.py/blob/master/test/catalogtests.py ? The tests in particular demonstrate most of what gsconfig supports.

···

On Thu, Dec 6, 2012 at 8:53 AM, Katie Essadro <katieessadro@anonymised.com.84…> wrote:

Can gsconfig.py be used to automatically add a store and layer into
Geoserver, or do I need to do that first manually?

Is there anyway to automatically create a store and layer through the API?

Thanks!
Katie


View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021208.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


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
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hello David,

First of all, thank you so much for taking the time to reply to my e-mail. I appreciate it. I have been working on this for weeks and not getting anywhere, partly I guess because I am incompetent with this stuff. I did look over the examples, but they didn;t seem to do anything I needed to do. I started looking over your catalogtests.py and I tried this:

cat = Catalog(“http://localhost:8080/geoserver/rest”)
ds = cat.create_coveragestore2(“aiptest1”)
ds.data_url = “file:C:/Users/katie/Desktop/test/pyramid”
cat.save(ds)

This crashed in the create_coveragestore2 call. Do I need to create a workspace first? Can you possibly provided me some quick sample code to create an Image Pyramid store and layer and publish that layer?

Thanks!
Katie

···

On Thu, Dec 6, 2012 at 8:53 AM, Katie Essadro <[hidden email]> wrote:

Can gsconfig.py be used to automatically add a store and layer into
Geoserver, or do I need to do that first manually?

Is there anyway to automatically create a store and layer through the API?

Thanks!
Katie


View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021208.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


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

[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Does example code exist anywhere to create the image payramid store?

In catalog.py I see:

    def create_coveragestore(self, name, data, workspace=None,
overwrite=False):

I have no idea what I need to be passing to the "self" and "data"
parameters. Can you please help?

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021233.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

I tried:

    ds = cat.create_coveragestore("aiptest1",
"file:C:/Users/chw12/Desktop/test/cablepyramid", "cable")

where "aiptest1" is the name of the store I want to create, and "cable" is
the name of my workspace. I get this error:

builtins.NameError: global name 'basestring' is not defined
File
"C:\Python32\Lib\site-packages\gsconfig-0.6.1-py3.2.egg\geoserver\catalog.py",
line 192, in get_store
  if isinstance(workspace, basestring):

Am I stupid, or is this incredibly difficult to use?

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021237.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

No, I don’t know of anyone using gsconfig to operate on pyramid stores. To my knowledge, it should be possible, but I don’t have an example.

‘self’ is going to be provided by Python, you don’t need to pass a value in your own code. data can be one of:

  • path to a ZIP archive or single-file coverage file (like a tiff.)
  • already-opened zip-archive or single-file coverage file
  • dict of files by extension which will be zipped up and uploaded (like: { ‘tfw’: ‘/path/to/file.tfw’, ‘tif’: ‘/path/to/file.tif’ })

I don’t think it’s common practice to upload a pyramid through the REST API so you will probably have better luck with create_coveragestore2 (which allows you to specify a path to a file already on the server.). When you use create_coveragestore2 what sort of ‘crash’ do you see? Can you post the error message? I think all you need to do may be to add (before saving):

ds.type = “ImagePyramid”

···

On Thu, Dec 6, 2012 at 9:56 AM, Katie Essadro <katieessadro@anonymised.com…> wrote:

Does example code exist anywhere to create the image payramid store?

In catalog.py I see:

def create_coveragestore(self, name, data, workspace=None,
overwrite=False):

I have no idea what I need to be passing to the “self” and “data”
parameters. Can you please help?


View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021233.html

Sent from the GeoServer - User mailing list archive at Nabble.com.


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
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Ok, I tried using create_coveragestore2 like so:

    cat = Catalog("http://localhost:8080/geoserver/rest&quot;\)
    ds = cat.create_coveragestore2("aiptest1")
    ds.data_url = "file:C:/Users/katie/Desktop/test/cablepyramid"
    ds.type = "ImagePyramid"
    cat.save(ds)

Here is the error:

builtins.NameError: global name 'basestring' is not defined
File
"C:\Python32\Lib\site-packages\gsconfig-0.6.1-py3.2.egg\geoserver\catalog.py",
line 240, in create_coveragestore2
  if isinstance(workspace, basestring):

Any idea what I did wrong?

Thanks!

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021247.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Well, gsconfig.py is not a very mature library - it is developed first for the needs of the GeoNode project and if it turns out to be useful for others like you, that’s great. But it is definitely rough around the edges (and actually getting worse as the GeoServer REST API expands and the very small body of gsconfig developers is not able to keep up.) So yes, it’s difficult to use (I wouldn’t say “incredibly,” but perhaps I am in a biased position.)

This latest error is due to you running on Python 3, which gsconfig has not yet been tested with. Apparently some development work is needed to reach compatibility - if you are able to downgrade to Python 2.7 that would probably be the most expedient approach, but if you’re interested in helping to bring gsconfig up to Python 3 compatibility we’d appreciate the help.

···

On Thu, Dec 6, 2012 at 10:11 AM, Katie Essadro <katieessadro@anonymised.com…84…> wrote:

I tried:

ds = cat.create_coveragestore(“aiptest1”,
“file:C:/Users/chw12/Desktop/test/cablepyramid”, “cable”)

where “aiptest1” is the name of the store I want to create, and “cable” is
the name of my workspace. I get this error:

builtins.NameError: global name ‘basestring’ is not defined
File
“C:\Python32\Lib\site-packages\gsconfig-0.6.1-py3.2.egg\geoserver\catalog.py”,
line 192, in get_store
if isinstance(workspace, basestring):

Am I stupid, or is this incredibly difficult to use?


View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021237.html

Sent from the GeoServer - User mailing list archive at Nabble.com.


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
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Ok I didn't mean to insult you in anyway when I said this was difficult to
use. It's most likely me, because I am new to this stuff :slight_smile:

Anyway, I downgraded to 2.7, and the code didn;t throw any bugs, but when I
went into Geoserver I did notice this:

I set the file URL to be:

    ds.data_url = "file:C:/Users/kaite/Desktop/test/cablepyramid"

and in Geoserver it says:

    file:data/

Any idea why the ds.data_url did not work?

Thanks!!

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021265.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

You need to give a workspace name when creating the store, and you should use
ds.url instead of ds.data_url

try the following:
restURL = 'http://localhost:8080/geoserver/rest
gsPassword = 'admin'
gsUser = 'geoserver'
workspace = 'SomeWorkSpace'
pyramidDir = 'C:/Users/katie/Desktop/test/cablepyramid'
storeName = 'NewStoreName'

cat = Catalog(restURL, gsPassword, gsUser)
cs = cat.create_coveragestore2(storeName, workspace)
cs.url = pyramidDir
cs.type = "ImagePyramid"
cat.save(cs)

This will only create the store, a layer will not be created. The store will
be created in the default workspace regardless of the workspace name you
specify...

Katie Essadro wrote

Ok, I tried using create_coveragestore2 like so:

    cat = Catalog("http://localhost:8080/geoserver/rest&quot;\)
    ds = cat.create_coveragestore2("aiptest1")
    ds.data_url = "file:C:/Users/katie/Desktop/test/cablepyramid"
    ds.type = "ImagePyramid"
    cat.save(ds)

Here is the error:

builtins.NameError: global name 'basestring' is not defined
File
"C:\Python32\Lib\site-packages\gsconfig-0.6.1-py3.2.egg\geoserver\catalog.py",
line 240, in create_coveragestore2
  if isinstance(workspace, basestring):

Any idea what I did wrong?

Thanks!

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021287.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

hmm ok that worked! Thanks!

Any idea how to get this working with Python 3.2? :slight_smile:

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021294.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Also, do you have example code on how to create a layer with this store and
then publish it?

Thanks!
Katie

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021295.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hello David,

I finally got a store created, but I am checking your test code, and I dont
see anywhere to create a layer and associated it with a store and then
publish that layer. Can you please point me in the right direction???

Thanks!
Katie

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/gsconfig-py-help-needed-tp5020642p5021300.html
Sent from the GeoServer - User mailing list archive at Nabble.com.