[gdal-dev] Re: Unreliable names for temporary files

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Tue Feb 14 00:21:37 EST 2012


________________________________________
Even Rouault wrote:


Le lundi 13 février 2012 06:22:31, Jukka Rahkonen a écrit :
>> Even Rouault <even.rouault <at> mines-paris.org> writes:
>> > Le dimanche 12 février 2012 14:25:07, Jukka Rahkonen a écrit :
>> > > Hi,
>> > >
>> > > I noticed a ticket http://trac.osgeo.org/gdal/ticket/4510 and started
>> > > to wonder if something similar can happen also elsewhere. I have had
>> > > troubles with Mapserver OGR output and they are somehow related to
>> > > temporary files (both physisical and vsimem files). See
>> > > http://lists.maptools.org/pipermail/ms4w-users/2012-February/001948.htm
>> > > l for some details.
>> >
>> > Jukka,
>> >
>> > The issue with the mapfile in http://lists.maptools.org/pipermail/ms4w-
>> > users/2012-February/001948.html is the default filename. For the CSV
>> > driver to create a single file, you need to change the filename to
>> > something ending with .csv (for example "default_outfile" "out.csv"),
>> > otherwise the CSV driver will create a directory, and when MapServer
>> > tries to read the filename, it is confused because it finds a directory,
>> > and not a file.
>>
>> Now I have these outputformats
>>
>> OUTPUTFORMAT
>>   NAME "SHAPEZIP"
>>   DRIVER "OGR/ESRI Shapefile"
>>   MIMETYPE "application/shapefile"
>>   FORMATOPTION "STORAGE=memory"
>>   FORMATOPTION "FORM=zip"
>>   FORMATOPTION "FILENAME=shape.zip"
>> END
>> OUTPUTFORMAT
>>   NAME "CSV"
>>   DRIVER "OGR/CSV"
>>   MIMETYPE "text/csv"
>>   FORMATOPTION "LCO:GEOMETRY=AS_WKT"
>>   FORMATOPTION "STORAGE=filesystem"
>>   FORMATOPTION "FORM=simple"
>>   FORMATOPTION "FILENAME=out.csv"
>> END
>>
>> You can try them:
>
>> http://188.64.1.61/cgi-bin/mapserver_wfs?service=wfs&version=1.1.0&request=
>> getfeature&typename=municipalities&outputformat=CSV Result is probably
>> "Failed to open result file"
>>
>> http://188.64.1.61/cgi-bin/mapserver_wfs?service=wfs&version=1.1.0&request=
>> getfeature&typename=municipalities&outputformat=SHAPEZIP Result is probably
>> an empty zip file.

> CC'ing to mapserver-users list.

> Similar requests with the 2 above outputformats work great on my local
> mapserver instance, so I suspect something wrong in your setup. If I issue the
> CSV request on your server, I see the following error message :
> <?xml version="1.0" encoding="UTF-8"?>
> <ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ows="http://www.opengis.net/ows" version="1.1.0" language="en-US"
> xsi:schemaLocation="http://www.opengis.net/ows
> http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd">
> <ows:Exception exceptionCode="NoApplicableCode" locator="mapserv">
>     <ows:ExceptionText>msOGRWriteFromQuery(): General error message. Failed to
> open result file '/usr/temp/4f3988d4_287f_0/out.csv'.</ows:ExceptionText>
>   </ows:Exception>
> </ows:ExceptionReport>

> The /usr/temp/ path look suspicious to me...

Hi,

/usr/temp/ has 7777 rights and it is good enough for the MS_ERRORFILE...

Short history of my trials:
- half a year ago tried to set up ogroutput with no success
- read a message about using "temppath" in the mapfile and added that parameter
- SHPZIP and CSV outpur started to work and I was happy
- but in the same evening the "Failed to open result file" errors came back
- never again had a new success with that Linux server
- not a single success with several Windows computers
- last week tried the new MS4W 3.0.4beta1 on Windows
- succeeded to make ogroutput to work for a while
- was suspicious and restarted Apache and started to get "Failed to open result" file errors again

It can of course be that I am just repeating my own errors but weird is that I have received valid CSV an SHAPEZIP outputs but only for a while.

-Jukka Rahkonen-


More information about the gdal-dev mailing list