Hi Justin,
Thanks for the response. Still not getting it to work though.  I have tried:
        $.ajax({
            type: "PUT",
            url: proxyurl + 
"http://localhost:8080/geoserver/rest/workspaces/jflow/coveragestores/test1/external.imagemosaic";,
            data: "file:///OpenSourceGIS/data/testmosaicREST/test1.shp",
            contentType: "text/plain",       //"application/zip",
            success: function(resp) {
alert('in success');
            },
            complete: function(xReq,txtStatus) {
alert('in complete: xReq.status=' + xReq.status + ' txtstatus=' + txtStatus + 
'; responseText= ' + xReq.responseText);
                if (xReq.responseText.indexOf("201") != -1) {
                    alert('Completed make ImageMosaic');
                }
            }
        });

(and various combinations of backslashes, different numbers of forward slashes 
etc in the data string) but GeoServer only gets as far as making a coverage 
store and nothing else, and returning an HTTP Server Error 500.  I don't really 
understand what the external.imagemosaic is supposed to do.  Should it make the 
whole mosaic, as if running the plugin, or would I still have to make a PUT 
request to define the coverage as well?

In answer to your comments/questions:
There are a couple of different ways to use this endpoint to configure a mosaic 
in this way. The method you are using is uploading the file directly.. which 
with a mosaic probably won't work unless you have all the individual files for 
the mosaic in the zip file... which you probably dont. Or if your shapefile 
contained absolute paths to all the files but I think usually they are relative.
The zip I was previously using did not contain the tifs (only the shapefile and 
properties files) but all the files are on the map server - and the index 
shapefile did contain the absolute paths (but I could change this to relative 
if important).
Thanks,
Anne

Anne Brookes
Senior Analyst - GIS and System Development

From: Justin Deoliveira [mailto:jdeol...@opengeo.org]
Sent: 25 January 2011 15:47
To: Anne Brookes
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Making imagemosaic through GeoServer REST API

Hi Anne,

There are a couple of different ways to use this endpoint to configure a mosaic 
in this way. The method you are using is uploading the file directly.. which 
with a mosaic probably won't work unless you have all the individual files for 
the mosaic in the zip file... which you probably dont. Or if your shapefile 
contained absolute paths to all the files but i think usually they are 
relative. I might be wrong about that.

That said, a method that might work better is to use the endpoint 
external.imagemosaic. This allows you to specify locations that already exist 
on the server rather than upload the files directly. In this case you woudl 
somehow upload all the files for the mosaic (including the shapefile index) to 
the server, and then call the endpoint to simply configure the coverage in 
geoserver.

Here are some useful links in the docs for you:

* 
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-examples-curl.html#adding-an-existing-shapefile

  for shapefile but same applies

* 
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html#data-stores

  scroll down until you see:


/workspaces/<ws>/datastores/<ds>/file[.<extension>]
/workspaces/<ws>/datastores/<ds>/url[.<extension>]
/workspaces/<ws>/datastores/<ds>/external[.<extension>]
Hope that helps.

-Justin

On Tue, Jan 25, 2011 at 8:33 AM, Anne Brookes 
<anne.broo...@jbaconsulting.co.uk<mailto:anne.broo...@jbaconsulting.co.uk>> 
wrote:
Hello All,
I am trying to use the REST API to dynamically configure an imagemosaic layer 
from GeoTIFF images, but without success. I have zipped up the .shp, .shx, .dbf 
and .prj files of the index shapefile and the properties file and have tried 
issuing a PUT request, as follows:

        $.ajax({
            type: "PUT",
            url: proxyurl + 
"http://localhost:8080/geoserver/rest/workspaces/jflow/coveragestores/test1/file.imagemosaic";,
            data: "test1.zip,
            contentType: "application/zip",
            success: function(resp) {
alert('in success');
            },
            complete: function(xReq,txtStatus) {
alert('in complete: xReq.status=' + xReq.status + ' txtstatus=' + txtStatus + 
'; responseText= ' + xReq.responseText);
                if (xReq.responseText.indexOf("201") != -1) {
                    alert('Completed make ImageMosaic');
                }
            }
        });
GeoServer gets as far as making a coveragestore for test1 but the url is 
defined as "file:data/test1/test1.imagemosaic" which generates an error in the 
logs (java.lang.IllegalArgumentException: 
/C:/Program%20Files/GeoServer%202.0.2/data_dir/data/test1/test1.imagemosaic is 
not one of the files types that is known to be associated with a shapefile).
I have read the thread 
(http://old.nabble.com/Reload-Mosaic-CoverageStore-Coverage-after-shp-properties-file-has-been-modified-td23928766.html)
 so it seems it is possible to do but I must be doing something wrong.

My questions are:

*         Do I just need the one PUT request or should I issue a POST request 
first to create the coverageStore (and possibly a second to amend the coverage 
properties)?

*         Should the .zip file be placed in the folder where the .tif files are 
located?

*         How does the file.imagemosaic request tell GeoServer where the images 
are located?

Any help much appreciated, thanks,
Anne




Anne Brookes
Senior Analyst - GIS and System Development



[cid:~WRD000.jpg]<http://www.jbaconsulting.co.uk/>


JBA Consulting
South Barn
Broughton Hall
Skipton
North Yorkshire
BD23 3AE
United Kingdom

[cid:~WRD000.jpg]<http://www.jbaconsulting.co.uk/?q=nce-winner-2010>


t: +44 (0)1756 799919 | f: +44 (0)1756 799449


JBA is a Carbon Neutral Company. Please don't print this e-mail unless you 
really need to.

This email is covered by JBA Consulting's email 
disclaimer<http://www.jbaconsulting.co.uk/emaildisclaimer>.



------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net<mailto:Geoserver-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geoserver-users



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

<<inline: ~WRD000.jpg>>

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to