Jesus Loves GRASS

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

Monday, June 04, 2007

Mapserver Versus Google Earth

Thinking of using google earth as a WMS layer in your mapserver project ??! Then think again !!!

Gregor Mosheh
Reply-To: Gregor Mosheh
Date: Thu, 1 Mar 2007 10:17:58 -0700
Content-Type: text/plain

There's no way to use Google Maps in Mapserver, due to Google's terms of
use. Some folks wrote a WMS gateway to Google Maps, for example, and got a
cease-and-desist for it.

There are other options, though, if you're willing/able to serve up your
Mapserver output via WMS. A) You could use Mapserver's WMS output in a
Google Map, because Google doesn't have a problem with that. B) Look for a
framework that supports both WMS and Google Maps and use that to import
both your WMS output and Google's basemap; I know that OpenLayers had
Google Maps support on their drawing board, but I don't know the status of
it.


Source: Mapserver Mailing List

Labels: , ,

Thursday, April 05, 2007

WCS wrapper for Mapserver

WMS,WFS and WCS is how it is possible to connected to a webGIS server and to download data:
WMS == Raster as an image
WFS == Vectorial information
WCS == Raster as a layer (original raster with values)

The request of WxF is normally done by a GET to the Mapserv program (is like a normal CGI-BIN for program execution), well I don't want Apache to run any program, so the solution is a wrapper PHP script, where the script catches the requests and uses them for a valid WCS reply.

The wrapper is very simple and there is a basic example on the mapserver home page, This is a wrapper with small modifications to work with WCS:

<?php
/*ows.php?service=WCS&version=1.0.0&Request=GetCapabilities*/
$request = ms_newowsrequestobj();

//$request->loadparams();

foreach ($_GET as $k=>$v) {
$request->setParameter($k, $v);
}



// forcing to version 1.0.0
$request->setParameter("VeRsIoN","1.0.0");

ms_ioinstallstdouttobuffer();

$oMap = ms_newMapobj("/usr/local/apache2/htdocs/secure/ms/data/calter.map");
$oMap->owsdispatch($request);
$contenttype = ms_iostripstdoutbuffercontenttype();
$buffer = ms_iogetstdoutbufferstring();

header('Content-type: application/xml');
echo $buffer;

ms_ioresethandlers();

?>

For start Mapserver only suports WCS version 1.0.0 so any request for higher versions has to be redirect:
$request->setParameter("VeRsIoN","1.0.0");

There seems to be a bug with $request->loadparams(); this produces an empy file reply from the server with no errors, so the solution it to get the parameters directely from the GET
foreach ($_GET as $k=>$v) {
$request->setParameter($k, $v);
}

if replacing $_GET for $_POST is should be possible to use POST to request the WCS, mapserver only accepts GET.

Labels: , , , , ,

Why not Openlayers ?

Despite the look of Ka-maps, there is the problem of Ka-maps not having an API and at first the code looked a bit confusing.

So I have a look at Openlayers, they seem to be more organized than Ka-maps but I didnt liked that the server requests are based on WxS and there is no PHP as "back-office", never the less the options given like the connection to google and virtual earth extremely interresting.

So in the end I started to work with Ka-maps

Labels: , ,