[mapserver-users] Extent and map size; Help needed
Marie Flanagan
theflan@gofree.indigo.ie
Thu, 16 May 2002 11:32:32 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_0005_01C1FCCD.5E611340
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello all,
I have a problem with a CGI script - in zooming in/out. I am drawing =
layers from a map file, 2 of the layers being created on the fly from a =
flat file of point labels and co-ordinates. One of the 'dynamic' layers =
is a line shape and can be added as a feature to the layer, the other is =
a set of points and labels, each of which has to be drawn separately =
(there may be another way of doing it but I haven't discovered it yet).
My set_extent subroutine seems to work in that the map extent is =
changed, but when the map is drawn it presents as a little map in the =
top left hand corner if I am zooming in - it's like the exent is working =
but the scale of the map is not changing. What am I missing?
Thanks in anticipation of any help offered.
Regards
Marie
Extract from the code:
&set_extent($zoomdir, $zoomsize, $imgx, $imgy, @image_extent);
$shape_layer->addFeature($shape);
$shape_layer->close();
# Now draw all the map layers. Point layer with labels will be drawn =
separately after this
for my $i (0 ..($map->{numlayers}-1))
{=20
my $layer =3D $map->getLayer($i);
$success =3D $layer->draw($map, $image);
print DBG "Drew layer $layer->{name} --------- $i ------ $success\n"; =
}
$num_stops =3D @stops_list -1;
for my $i (0 .. $num_stops)
{
$display_count =3D $i + 1;
my ($x, $y, $desc) =3D split(/\t/, $stops_list[$i]);
if ($i=3D=3D0) { $desc=3D"[ $display_count ] START," . $desc; }
if ($i=3D=3D ($num_stops)) { $desc =3D "[ $display_count ] FINISH," . =
$desc; }
if ($i > 0 && $i < ($num_stops)) { $desc =3D "[ $display_count ]"; }
print DBG "$stops_list[$i] ... $i ... $desc \n";
$draw_pt1=3Dnew pointObj();
$draw_pt1->{x} =3D $x;
$draw_pt1->{y} =3D $y;
$draw_pt1->draw($map, $pt_label, $image, undef, "$desc");=20
$draw_pt2=3Dnew pointObj();
$draw_pt2->{x} =3D $x;
$draw_pt2->{y} =3D $y;
$draw_pt2->draw($map, $pt_layer, $image, undef, undef);=20
$i++;
}
------=_NextPart_000_0005_01C1FCCD.5E611340
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello all,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I have a problem with a CGI script - in =
zooming=20
in/out. I am drawing layers from a map file, 2 of the layers being =
created=20
on the fly from a flat file of point labels and co-ordinates. One =
of the=20
'dynamic' layers is a line shape and can be added as a feature to the =
layer, the=20
other is a set of points and labels, each of which has to be drawn =
separately=20
(there may be another way of doing it but I haven't discovered it=20
yet).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>My set_extent subroutine seems to work =
in that the=20
map extent is changed, but when the map is drawn it presents as a little =
map in=20
the top left hand corner if I am zooming in - it's like the exent is =
working but=20
the scale of the map is not changing. What am I =
missing?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in anticipation of any help=20
offered.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Regards</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Marie</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Extract from the code:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>&set_extent($zoomdir, $zoomsize, =
$imgx, $imgy,=20
@image_extent);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>$shape_layer->addFeature($shape);<BR>$shape_layer->close()=
;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2># Now draw all the map layers. =
Point layer=20
with labels will be drawn separately after this<BR>for my $i (0=20
..($map->{numlayers}-1))<BR>{ <BR> my $layer =3D=20
$map->getLayer($i);<BR> $success =3D =
$layer->draw($map,=20
$image);<BR> print DBG "Drew layer $layer->{name} =
--------- $i=20
------ $success\n"; <BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>$num_stops =3D @stops_list -1;<BR>for =
my $i (0 ..=20
$num_stops)<BR>{<BR> $display_count =3D $i + =
1;<BR> my=20
($x, $y, $desc) =3D split(/\t/, $stops_list[$i]);<BR> if =
($i=3D=3D0) {=20
$desc=3D"[ $display_count ] START," . $desc; }<BR> if =
($i=3D=3D=20
($num_stops)) { $desc =3D "[ $display_count ] FINISH," . $desc; =
}<BR> =20
if ($i > 0 && $i < ($num_stops)) { $desc =3D "[ =
$display_count ]";=20
}<BR> print DBG "$stops_list[$i] ... $i ... $desc=20
\n";<BR> $draw_pt1=3Dnew pointObj();<BR> =
$draw_pt1->{x}=20
=3D $x;<BR> $draw_pt1->{y} =3D $y;<BR> =20
$draw_pt1->draw($map, $pt_label, $image, undef, "$desc"); =
<BR> =20
$draw_pt2=3Dnew pointObj();<BR> $draw_pt2->{x} =3D=20
$x;<BR> $draw_pt2->{y} =3D $y;<BR> =20
$draw_pt2->draw($map, $pt_layer, $image, undef, undef); =
<BR> =20
$i++;<BR>}</FONT></DIV></BODY></HTML>
------=_NextPart_000_0005_01C1FCCD.5E611340--