[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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have a problem with a CGI script - in =
zooming=20
in/out.&nbsp; 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.&nbsp; 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.&nbsp; What am I =
missing?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in anticipation of any help=20
offered.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Marie</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Extract from the code:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&amp;set_extent($zoomdir, $zoomsize, =
$imgx, $imgy,=20
@image_extent);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>$shape_layer-&gt;addFeature($shape);<BR>$shape_layer-&gt;close()=
;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2># Now draw all the map layers.&nbsp; =
Point layer=20
with labels will be drawn separately after this<BR>for my $i (0=20
..($map-&gt;{numlayers}-1))<BR>{ <BR>&nbsp;&nbsp; my $layer =3D=20
$map-&gt;getLayer($i);<BR>&nbsp;&nbsp; $success =3D =
$layer-&gt;draw($map,=20
$image);<BR>&nbsp;&nbsp; print DBG "Drew layer $layer-&gt;{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>&nbsp;&nbsp; $display_count =3D $i + =
1;<BR>&nbsp;&nbsp; my=20
($x, $y, $desc) =3D split(/\t/, $stops_list[$i]);<BR>&nbsp;&nbsp; if =
($i=3D=3D0) {=20
$desc=3D"[ $display_count ] START," . $desc; }<BR>&nbsp;&nbsp; if =
($i=3D=3D=20
($num_stops)) { $desc =3D "[ $display_count ] FINISH," . $desc; =
}<BR>&nbsp;&nbsp;=20
if ($i &gt; 0 &amp;&amp; $i &lt; ($num_stops)) { $desc =3D "[ =
$display_count ]";=20
}<BR>&nbsp;&nbsp; print DBG "$stops_list[$i] ... $i ... $desc=20
\n";<BR>&nbsp;&nbsp; $draw_pt1=3Dnew pointObj();<BR>&nbsp;&nbsp; =
$draw_pt1-&gt;{x}=20
=3D $x;<BR>&nbsp;&nbsp; $draw_pt1-&gt;{y} =3D $y;<BR>&nbsp;&nbsp;=20
$draw_pt1-&gt;draw($map, $pt_label, $image, undef, "$desc"); =
<BR>&nbsp;&nbsp;=20
$draw_pt2=3Dnew pointObj();<BR>&nbsp;&nbsp; $draw_pt2-&gt;{x} =3D=20
$x;<BR>&nbsp;&nbsp; $draw_pt2-&gt;{y} =3D $y;<BR>&nbsp;&nbsp;=20
$draw_pt2-&gt;draw($map, $pt_layer, $image, undef, undef); =
<BR>&nbsp;&nbsp;=20
$i++;<BR>}</FONT></DIV></BODY></HTML>

------=_NextPart_000_0005_01C1FCCD.5E611340--