OGC / MapScript questions

Tom Kralidis tomkralidis at hotmail.com
Mon Feb 26 11:36:09 EST 2001


Stephen,

Thanks for the information.

I've gotten MapScript to work on my box, seems it was the mapfile.

If I have a simple mapfile:

NAME CAN
EXTENT -99 50 -73 55 # ONTARIO
UNITS DD

SHAPEPATH "/home/gis/data/wmp/"

SIZE 500 300

LAYER
NAME TEMP
TYPE RASTER
STATUS DEFAULT
DATA TEMP.gif
TRANSFORM FALSE
END

LAYER
NAME prov_terr_outline
TYPE POLYLINE
STATUS DEFAULT
DATA prov_terr
CLASS
  COLOR 0 0 0
  OUTLINECOLOR 0 0 0
END
END  # LAYER

END  # MAPFILE

...and my mapscript.pl:

#!/usr/bin/perl

use LWP::Simple
my $content = 
get("http://naboo/cgi-bin/mapserv/ms-ogc.pl?request=map&layers=elevation,roads,lakes,rivers,boundary
,cities&BBOX=-99,50,-73,55&WIDTH=500&HEIGHT=300");
  my $file = "/www/htdocs/gis/mapserv/mapscript/test.map";
  my $map = new mapObj("$file") or die "Unable to open mapfile: $!\n";

  my $layer = $map->getLayerByName('TEMP');

  $layer->{data} = $content;

  my $img = $map->prepareImage() or die('Unable to draw map $!');

  $map->draw();
  $layer->draw($map, $img); # draw basemap

  setOutput();
  mapscript::msSaveImage($img, undef , $map->{interlace}, 
$map->{transparent});
#  print STDOUT $content;

I get nothing.  I'm getting the ms-ogc layer via LWP.  setOutput() prints 
out the content type (image/gif), etc.  The $content data is there, I can 
view it if I simply print it out to display.  How can I add this to my map?  
I put a dummy TEMP layer for the OGC layer.  Can I dynamically add layers 
instead (how?)?

Thanks

..Tom

>
>OGC compliance is coming, but first it will exist on the server level and 
>then
>perhaps at the client level. That is, initially MapServer will be able to 
>act as
>a compliant WMT server and will not be a WMT client.
>
>That said you should be able to integrate other WMT server output into your
>maps using MapScript. The basic algorithm would be:
>
>   1) open map, set extents etc.
>   2) step through layers, rendering each in turn, if the layer is to be 
>retrieved
>       elsewhere then nab the image, save it and alter the layer definition 
>to use
>       it. remember you can use gif/png in images without world files 
>(TRANSFORM
>       FALSE).
>   3) write output image/page
>   4) cleanup
>
>MapScript is intended as a way to replace the MapServer CGI. It's possible 
>to
>rewrite the CGI version in perl or whatever. By the same token you can 
>write
>very custom applications that do things the generic CGI C implementation 
>can't
>do. You could also use the C library, but scripting seems to appeal to a 
>larger
>audience. There are ways to integrate MapScript apps with the CGI version
>such as writing custom mapfiles or retrieving/creating custom data before
>passing a request to the CGI piece. That would save re-writing template
>processing functionality.
>
>I've not seen the error you mention before. Try searching perl.com...
>
>Steve
>
>Stephen Lime
>Internet Applications Analyst
>
>Minnesota DNR
>500 Lafayette Road
>St. Paul, MN 55155
>651-297-2937
>
> >>> "Tom Kralidis" <tomkralidis at hotmail.com> 02/14/01 01:47PM >>>
>Hi,
>
>I'v been working w/ MapServer to build a basic application.  Until now, I
>have not used any MapScript.
>
>I would like to integrate layers called from OGC-type servers (eg.
>clearinghouse dcw data), to overlay onto my datasets.  I have a script to
>return an OGC-style response of data BBOX, and would like to glue this into
>mapserver.
>
>I understand OGC compliance is forthcoming, but is this possible in
>MapScript in the interim?  Does anyone have any examples of this working?
>
>I tried running the site example for MapScript on my web server:
>
>#!/usr/bin/perl -w
>
>use mapscript;
>
>my $map = new mapObj('/www/htdocs/gis/mapserv/wmp/wmp-dev.map') or die
>"Unable to open mapfile: $!\n";
>my $img = $map->draw() or die('Unable to draw map');
>mapscript::msSaveImage($img, '/tmp/imgfile', $map->{interlace},
>$map->{transparent});
>
>and get the following error in my error_log:
>
>Unable to open mapfile: Inappropriate ioctl for device
>
>I'm running mapserver on a RedHat6.2 with Apache-1.3.14
>
>Anyone had this type of issue?
>
>How does one deal w/ MapScript?  Does it replace the mapserv binary as the
>driving application, calling everthing through there?
>
>Any advice would be appreciated.
>
>Thanks
>
>..Tom
>
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.




More information about the mapserver-users mailing list