[Geoserver-devel] problem with rest api

Hello

First I would like to understand how rest api works.

I tried to upload a geotiff file via rest api.

For example if I want to create a layer of type coverage I upload the file with this synthaxe:

http://localhost:8081/geoserver/rest/workspaces/namespaceName/coveragestores/coverageStoreName/url.geotiff

and I push the url of the file into the httpurlconnection outputstream.

this atually create a folder in /workspaceName/CoverageStoreName create a xml file named coverageStore.xml and put et layer.xml and a coverage.xml.

The problem is that it also copies the geotiff file into /data directory instead of putting it into /data/layerName inorder to be rendered by geoserver.

I don’t understand why.

I found another synthaxe:

http://localhost:8081/geoserver/rest/workspaces/namespaceName/coveragestores/coverageStoreName/file.geotiff

that put the right file in the right folder in /data/LayerName but doesn’t create the configuration files associated with the coverage.

Could you please explain how RestApi works in this case .

I have another question:

When I try to upload a big file, the jvm returns an out of memory exception. Is there a limited data size to post by restApi?

In this case, how can I post Big files wich are pyramid-shaped with gdal.There is a utility that produce an index shapefile and a property file but How can I insert this in geoserver layers.

Last question:

How is it possible to update a layer or a lyergroup for example via rest with method PUT but without writing all the xml code into the httpUrlConnection outputStream.

Is it possible for exemple to add a layer to a layergroup only with the xml code of the layer.

I don’t have question anymore. Thnank you for by advance for you answer.

Jean-Baptiste


Save up to 84% on Windows 7 until Jan 3—eligible CDN College or University students only. Hurry—buy it now for $39.99!

On 23/10/09 10:36, du pre jannot wrote:

I found another synthaxe:

http://localhost:8081/geoserver/rest/workspaces/namespaceName/coveragestores/coverageStoreName/file.geotiff

that put the right file in the right folder in /data/LayerName but
doesn’t create the configuration files associated with the coverage.

Could you please explain how RestApi works in this case .

You have to issue two requests: the first creating the coveragestore by posting the image, the second creating the coverage based on said coveragestore.

I have another question:

When I try to upload a big file, the jvm returns an out of memory
exception. Is there a limited data size to post by restApi?

I cannot help you on this.

How is it possible to update a layer or a lyergroup for example via rest
with method PUT but without writing all the xml code into the
httpUrlConnection outputStream.

As far as I know, only the updated XML element(s) should be inserted in the request: for instance, to assign a default style to a layer you have to provide only the defaultStyle lement:
curl -u admin:geoserver -XPUT -H 'Content-type: text/xml' \
   -d '<layer><defaultStyle><name>roads_style</name></defaultStyle></layer>' \
   http://localhost:8080/geoserver/rest/layers/acme:roads

Regards,

P.S.
This kind of questions are better asked to the user list.

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------

Hi,

Luca Morandini wrote:

On 23/10/09 10:36, du pre jannot wrote:

I found another synthaxe:

http://localhost:8081/geoserver/rest/workspaces/namespaceName/coveragestores/coverageStoreName/file.geotiff

that put the right file in the right folder in /data/LayerName but
doesn’t create the configuration files associated with the coverage.

Could you please explain how RestApi works in this case .

You have to issue two requests: the first creating the coveragestore by posting the image, the second creating the coverage based on said coveragestore.

This is not exactly true. You can do it with one request, but you need to use file.geotiff if you are going to send the file in the body of the request, and you should use url.geotiff, if the file is located somewhere external. url.geotiff is not that well tested.

So I think what probably happened is you tried with url.geotiff, there was an error, and then there was a conflict when trying to use file.geotiff.

So what I suggest is you remove the coverage store configuration, remove the uploaded file, and try again with a clean configuration and data directory.

I have another question:

When I try to upload a big file, the jvm returns an out of memory
exception. Is there a limited data size to post by restApi?

The memory is constrained by the memory available to the java runtime. So i suggest increasing the amount of memory given to the jvm.

That said the code should stream the file but there could be issues with the entire file being dragged into memory. I will have to look into this.

I cannot help you on this.

How is it possible to update a layer or a lyergroup for example via rest
with method PUT but without writing all the xml code into the
httpUrlConnection outputStream.

As far as I know, only the updated XML element(s) should be inserted in the request: for instance, to assign a default style to a layer you have to provide only the defaultStyle lement:
curl -u admin:geoserver -XPUT -H 'Content-type: text/xml' \
   -d '<layer><defaultStyle><name>roads_style</name></defaultStyle></layer>' \
   http://localhost:8080/geoserver/rest/layers/acme:roads

This is correct. Good explanation.

Regards,

P.S.
This kind of questions are better asked to the user list.

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.