[ZOO-Discuss] some problems with the zoo-services examples

Marco Negretti marco.negretti at polimi.it
Mon Oct 25 08:10:20 PDT 2010


Il 23/10/2010 17:20, Gérald Fenoy ha scritto:

>>
>> =======
>> ogr/ogr2ogr
>
> This example was tested today and it works well. You have to know that
> this service will require that you set the dataPath variable in the main
> section of your main configuration file to the directory where your data
> is located. Indeed the ogr2ogr service concat the dataPath and the
> filename (shall be a simple filename not a path) to access the original
> datasource, then the service use the tmpPath to store the produced file
> (so this last shall also be set in the main section of your main
> configuration file).
>
> The new zcfg file was commited on the SVN source tree today. I've also
> modify the ogr2ogr_service code to add the specific error message when
> the service fails. This way we shall no more get the "No more
> information available" message displayed (except maybe for unhandled
> error :] ).
>

Hi Gérald,
thank you for your suggestion;
so far I have tested only ogr/ogr2ogr and it works!
I'm happy!

I've only few corrections to suggest you.

In Ogr2Ogr.zcfg file:
the [F] parameter sets the output format, not the input format 
(http://www.gdal.org/ogr2ogr.html) so I have modified the rows 14 and 15:
Title = Format of the output data
Abstract = Select the output format.
instead of
Title = Format of the input data
Abstract = Select the input format.

The output file will be created always in tmppath, so I think it is 
better to modify row 40:
Abstract = The output data name
instead of
Abstract = The full path of the output data source name created.

In ogr/ogr2ogr/service.c
I notice that in the response page the path to the output data refers to 
the server path (tmpPath variable in the main section):
<wps:Data>
   <wps:LiteralData>/usr/local/mapserv_tmp/lakespy2</wps:LiteralData>
</wps:Data>

I think it is better to give the web path (tmpUrl variable in the main 
section): the hypothetical user can't access directly to the server 
path, but only to the url path of the web service.

So I added some code to the service.c file:
after row 80:
const char  *pszwebDestData = NULL;

after row 125 (referring to the original file without the previous 
modification):
tmpMap=NULL;
char serverAddress[1024];
tmpMap=getMapFromMaps(conf,"main","serverAddress");
if(tmpMap!=NULL){
      sprintf(serverAddress,"%s",tmpMap->value);
}

tmpMap=NULL;
char tmpurl[1024];
tmpMap=getMapFromMaps(conf,"main","tmpurl");
if(tmpMap!=NULL){
         sprintf(tmpurl,"%s",tmpMap->value);
}

after row 342 (referring to the original file without the previous 
modification):
pszwebDestData=(char*)malloc(sizeof(char)*(strlen(serverAddress)+strlen(tmpurl)+strlen(tmpMap->value)+4));
sprintf((char*)pszwebDestData,"%s%s/%s",serverAddress,tmpurl,tmpMap->value/*,ext*/);

and I replace row 813 
outputs->content=createMap("value",(char*)pszDestDataSource);
with:
outputs->content=createMap("value",(char*)pszwebDestData);

In this way I have this output:
<wps:Data>
    <wps:LiteralData>http://localhost/tmp/lakespy2</wps:LiteralData>
</wps:Data>



ciao
Marco


-- 

Marco Negretti
Politecnico di Milano - Polo Regionale di Como
email:  marco.negretti at polimi.it
http://geomatica.como.polimi.it/

_________________________________________________________
http://www.gnu.org/philosophy/no-word-attachments.it.html



More information about the Zoo-discuss mailing list