[mapserver-users] mapscript point problem solved (fwd)

teb teb at mallit.fr.umn.edu
Tue Sep 11 06:24:28 PDT 2001


------------- Begin Forwarded Message -------------

From: "Steven Hayes" <shayes at bigpond.net.au>
To: <mapserver-info at lists.gis.umn.edu>
Subject: mapscript point problem solved
Date: Tue, 11 Sep 2001 22:24:32 +1000
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200

Hi,

as is almost always the case with me, as soon as I sent my last email to the
list regarding using the pointObj() method I solved the problem by simply
thinking it through. As mapscript examples seem to be a bith thin on the
ground perhaps this one might help someone now it works.

#! /usr/bin/perl

# plots a test point on a map - written as a test prior to generating entire
point layer from sql
# query

use CGI qw/:standard :html3 -no_debug/;
use mapscript;

$q = new CGI;

print $q->header();

$map = new mapObj("/www/hosted/streamwatch/cgi-bin/streamwatch.map") or
die('Unable to open mapfile.');
my $layer = $map->getLayerByName('regall');
$layer->{status} = $mapscript::MS_ON;
my $layer = $map->getLayerByName('ocean');
$layer->{status} = $mapscript::MS_ON;
my $layer = $map->getLayerByName('rivall');
$layer->{status} = $mapscript::MS_ON;


$point = new pointObj();
$point->{y} = -33.7577;
$point->{x} = 151.0188;

$map->{extent}->{minx}= 150.9000;
$map->{extent}->{miny}= -33.6000;
$map->{extent}->{maxx}= 151.1000;
$map->{extent}->{maxy}= -33.8000;
$map->{height} = 300;
$map->{width} = 300;

my $img = $map->prepareImage();
#$layer->draw($map, $img);

$img = $map->draw() or die('Unable to draw map');
$layer = $map->getLayerByName('sw_dynamic_sites');
$point->draw($map, $layer, $img, 0, "test point");
$map->drawLabelCache($img);

mapscript::msSaveImage($img, undef, $map->{interlace}, $map->{transparent});


Regards

Steven Hayes


------------- End Forwarded Message -------------





More information about the MapServer-users mailing list