Jesus Loves GRASS

Technical blog about GRASS/GIS,open source geoinformatics and MAPSERVER.

Tuesday, June 12, 2007

IE header problem in Ka Map print_map.php

I was thinking that everything was ok with the printing system, but yesterday I was with my supervisors and he used Internet Explorer, when he tried to download and image file with the screen content of Ka-maps, the IE said:
"Internet Explorer cannot download...cale12000000&output_type=JPEG"

"Internet Explorer was not able to open this Internet site"

Since I saw the & and some GET like structure I thought it was some PHP error....

The problem is in the header creation of the print_map.php, which works fine for Firefox but it has some problems with IE.

I have searched on the PHP tutorial help and read several things and so far the best header is something like this:


$mm_type="image".strtolower($_REQUEST['output_type']);
$filename_ext=$oMap->name . ".".strtolower($_REQUEST['output_type']);
header("Cache-Control: public, must-revalidate\n");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT'.'\n');
header("Cache-Control: no-store, no-cache, must-revalidate\n");
header("Cache-Control: post-check=0, pre-check=0\n", false );
header("Pragma: Internet Explorer is shitty\n"); //Otherwise it will give error
header("Content-Type: " . $mm_type."\n");
header("Content-Length: " .(string)(filesize($szImg))."\n");
header('Content-Disposition: attachment; filename='.$filename_ext."\n");
header("Content-Transfer-Encoding: binary\n");
fpassthru($h);
fclose($h);

-The headers for what I read are prepared for non-cache in HTTP 1.0 and 1.1
-Without the Pragma: (something), IE will give the same error, I haven't found why, but is what people do
- The \n is seems to be necessary for IE7 that needs a more tight header (but I haven't checked if it's true)

Labels: , , ,

Saturday, April 07, 2007

WCS headache

Well Today I had a huge headache


The big problem started when I was doing a DescribeCoverage request and was getting nothing, as if there was no WCS layers (I had all the WCS metadata inside the map file), the result was only this

<CoverageDescription version="1.0.0" updateSequence="0" xsi:schemaLocation="http://www.opengis.net/wcs http://schemas.opengis.net/wcs/1.0.0/describeCoverage.xsd">
</CoverageDescription>

So no error, no major problems and of course nothing on the net!!!

I tryed to make a getCoverage and got an error message concerning projection,

Since my server is jailed there was no epsg file for the mapserver to read, I never had a problem with projections because I never had the need for epsg, since my projection was like this:

PROJECTION
"proj=latlong"
"ellps=WGS84"
"datum=WGS84"
END

(no: "init=epsg:4326")

So copying the epsg file to the chroot and adding the location of it to the map file solved the problem (CONFIG "PROJ_LIB" "/usr/local/share/proj")

Then I got a nice reply fron the DescribeCoverage, still I got some problems with the GetCoverage because instead of epsg I had epgs (....I hate this type of mistakes)

It took me several hours to discover all the problems....I wish that a better error log system would be in place for WxS

Labels: , , ,