0

The docuentation leaves me in the dark about this. We used to call static mapfiles directy by:

 http://www.domain.com/cgi-bin/mapserv?map=/var/www/mapfiles/mf.map?[parameters]

But now I want to call a mapscript instead of the mapfile directly.

How do I do this?

EDIT: i'm using PHP mapscript 4.10, on mapserver 5.03. PHP is not configured to run as CGI.

asked Sep 18, 2013 at 7:59
1
  • The link provided by unicoletti, below, helped me on my way Commented Sep 24, 2013 at 8:14

2 Answers 2

1

Mapserver mapscript is a wrapper around the mapserver APIs that exposes them to a host programming language. Supported programming languages are: Python, Java, C#, Perl, Ruby, Tcl. PHP is also supported, it only differs from the others in how the API is exposed to the PHP interpreter.

That being said one of the ways you could invoke mapscript is by creating a script which simply emulates the behaviour of a standard, Mapserver-backed, WMS service. There are some examples here:

http://mapserver.org/ogc/mapscript.html

There are several reasons for doing this: interpolation of results or input params, alteration of the resulting image, caching, accounting, etc.

If instead what you are aiming for is using a scripting language to dynamically alter your mapfile depending on certain conditions you can of course achieve that through mapscript, but you should also know there is effort underway to embed a javascript interpreter in Mapserver for this very purpose. Note: this feature is limited, not complete and still experimental, YMMV.

answered Sep 18, 2013 at 8:33
0

Assuming you are programming in say php:-

Create a file map.php in your cgi-bin along the lines of:-

<?php
dl("php_mapscript_4.10.0.dll");
$request = ms_newowsrequestobj();
$request->loadparams();
$mapFileString = 'BUILD YOUR MAP FILE AS A STRING';
$oMap = ms_newMapObjFromString($mapFileString);
..then do your stuff here
?>

This avoids the need to open a static mapfile which is what I think you are asking

It would be called by (for example if your were creating a WMS service):-

http://www.domain.com/cgi-bin/map.php?service=WMS&version=1.1.1&Request=GetCapabilities

answered Sep 18, 2013 at 10:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.