[Mapserver-users] Center map on feature?

Marcelo Carrillo marcelito20 at hotmail.com
Mon Jul 26 09:57:32 EDT 2004


--------------Boundary-00=_WFPGQL80000000000000
Content-Type: Multipart/Alternative;
  boundary="------------Boundary-00=_WFPGLVC0000000000000"


--------------Boundary-00=_WFPGLVC0000000000000
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

 =0D
 Hi maybe this code can help you, this function receives a array with
positions and a distance and sets de extent of the map in order to show a=
ll
the features(points) you receive in the array.=0D
=0D
=0D
function centrarFlota($posiciones,$distancia){=0D
 $num_autos=3Dcount($posiciones);=0D
 $m=3D0;=0D
 if($_SESSION['num_pos']>0&&$posiciones[0][1]!=3D"" && $posiciones[0][2]!=
=3D""
){=0D
  $min_x=3D999999999;=0D
  $min_y=3D999999999;=0D
  $max_x=3D0;=0D
  $max_y=3D0;=0D
  =0D
  for($i=3D0;$i<$num_autos;$i++){=0D
    if ($posiciones[$i][1]!=3D"" && $posiciones[$i][2]!=3D"" ){=0D
    if ($posiciones[$i][1]<$min_x){=0D
     $min_x=3D$posiciones[$i][1];=0D
    }=0D
    if ($posiciones[$i][1]>$max_x){=0D
     $max_x=3D$posiciones[$i][1];=0D
    }=0D
    if ($posiciones[$i][2]<$min_y){=0D
     $min_y=3D$posiciones[$i][2];=0D
    }=0D
    if ($posiciones[$i][2]>$max_y){=0D
     $max_y=3D$posiciones[$i][2];=0D
    }=0D
   }else {=0D
    $_SESSION['noinfo']=3D" <span class=3D'greysmaller'>NO DATA AVAILABLE=
</span>
;=0D
    //break;=0D
   }=0D
  }=0D
  =0D
  $min_x =3D $min_x-$distancia;=0D
  $max_x =3D $max_x+$distancia;=0D
  $min_y =3D $min_y- $distancia;=0D
  $max_y=3D$max_y+$distancia;=0D
  =0D
  $_SESSION["miMap"]->setextent($min_x,$min_y,$max_x,$max_y);=0D
  $_SESSION['noinfo']=3D"";=0D
 }else{=0D
  $_SESSION['noinfo']=3D" <span class=3D'greysmaller'>NO DATA AVAILABLE</=
span>";=0D
 }=0D
 $_SESSION['map_extent']=3D $_SESSION["miMap"]->extent->minx." ".$_SESSIO=
N[
miMap"]->extent->miny." "=0D
 .$_SESSION["miMap"]->extent->maxx." ".$_SESSION["miMap"]->extent->maxy;=0D
 =0D
}=0D
=0D
Sorry for my english, hope you use it.=0D
=0D
Regards,=0D
=0D
  =0D
Marcelo Ismael Carrillo Est=E9vez=0D
BAYTEQ C=EDa. Ltda.=0D
09-8813885 =0D
"There's no place like 127.0.0.1"=0D
-------Mensaje original-------=0D
 =0D
De: mapserver at lparchaeology.com=0D
Fecha: 26/07/2004 8:39:21=0D
Para: Mapserver Users=0D
Asunto: [Mapserver-users] Center map on feature?=0D
 =0D
I would like to ask the list for any ideas about how I can centre a map=0D
on a specific site/feature.=0D
 =0D
We currently link from a site result page (generated from a database) to=0D
a map search page by grabbing the X,Y UTM zone 33 values for the site=0D
that we hold in the database. e.g. reference map  link on page:=0D
 =0D
http://www.fastionline.org/php/content.php?item=3D4&site_id=3D80&lang=3Di=
t=0D
 =0D
will take you to the main map page centred on the site.=0D
 =0D
However, we have recently begun to add sites that are in UTM zone 32. We=0D
project all this very neatly using mapserver. However, we need to think=0D
of a new way to link back from a single site to the main map centred on=0D
the site.=0D
 =0D
Any suggestions would be very welcome. Every site has a unique id which=0D
is also present in our shapefile.=0D
 =0D
Many thanks,=0D
 =0D
Guy=0D
 =0D
--=0D
Guy Hunt=0D
 =0D
L - P : Archaeology=0D
www.lparchaeology.com=0D
 =0D
 =0D
--=0D
Guy Hunt=0D
 =0D
L - P : Archaeology=0D
www.lparchaeology.com=0D
 =0D
 =0D
_______________________________________________=0D
Mapserver-users mailing list=0D
Mapserver-users at lists.gis.umn.edu=0D
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
--------------Boundary-00=_WFPGLVC0000000000000
Content-Type: Text/HTML;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-=
1">
<META content=3D"IncrediMail 1.0" name=3DGENERATOR></HEAD>
<BODY style=3D"BACKGROUND-POSITION: left 0px; SCROLLBAR-FACE-COLOR: #c6d7=
ff; FONT-SIZE: 12pt; MARGIN: 5px 10px 10px 25px; SCROLLBAR-HIGHLIGHT-COLO=
R: #ffffff; SCROLLBAR-SHADOW-COLOR: #ffffff; COLOR: #400000; SCROLLBAR-3D=
LIGHT-COLOR: #7b9ed6; SCROLLBAR-ARROW-COLOR: #4a6184; BACKGROUND-REPEAT: =
repeat; FONT-FAMILY: Times New Roman; SCROLLBAR-DARKSHADOW-COLOR: #bebebe=
" text=3D#400000 vLink=3D#0000ff aLink=3D#0000ff link=3D#0000ff bgColor=3D=
#ffffff background=3Dcid:64210532-B54A-498F-A3A2-890DD117595A scroll=3Dye=
s SIGCOLOR=3D"0" ORGYPOS=3D"0">
<TABLE id=3DINCREDIMAINTABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100=
%" border=3D0>
<TBODY>
<TR>
<TD id=3DINCREDITEXTREGION style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 0px=
; FONT-SIZE: 12pt; PADDING-BOTTOM: 0px; CURSOR: auto; PADDING-TOP: 0px" v=
Align=3Dtop width=3D"100%">
<DIV>&nbsp;</DIV>
<DIV>&nbsp;Hi maybe this code can help you, this function receives a arra=
y with positions and a distance and sets de extent of the map in order to=
 show all the features(points)&nbsp;you receive&nbsp;in the array.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>function centrarFlota($posiciones,$distancia){<BR>&nbsp;$num_autos=3D=
count($posiciones);<BR>&nbsp;$m=3D0;<BR>&nbsp;if($_SESSION['num_pos']&gt;=
0&amp;&amp;$posiciones[0][1]!=3D"" &amp;&amp; $posiciones[0][2]!=3D"" ){<=
BR>&nbsp;&nbsp;$min_x=3D999999999;<BR>&nbsp;&nbsp;$min_y=3D999999999;<BR>=
&nbsp;&nbsp;$max_x=3D0;<BR>&nbsp;&nbsp;$max_y=3D0;<BR>&nbsp;&nbsp;<BR>&nb=
sp;&nbsp;for($i=3D0;$i&lt;$num_autos;$i++){<BR>&nbsp;&nbsp;&nbsp;&nbsp;if=
 ($posiciones[$i][1]!=3D"" &amp;&amp; $posiciones[$i][2]!=3D"" ){<BR>&nbs=
p;&nbsp;&nbsp;&nbsp;if ($posiciones[$i][1]&lt;$min_x){<BR>&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;$min_x=3D$posiciones[$i][1];<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<=
BR>&nbsp;&nbsp;&nbsp;&nbsp;if ($posiciones[$i][1]&gt;$max_x){<BR>&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;$max_x=3D$posiciones[$i][1];<BR>&nbsp;&nbsp;&nbsp;&=
nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;if ($posiciones[$i][2]&lt;$min_y){<BR>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$min_y=3D$posiciones[$i][2];<BR>&nbsp;&nbsp;=
&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;if ($posiciones[$i][2]&gt;$max_y=
){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$max_y=3D$posiciones[$i][2];<BR>&nbsp=
;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}else {<BR>&nbsp;&nbsp;&nbsp;&n=
bsp;$_SESSION['noinfo']=3D" &lt;span class=3D'greysmaller'&gt;NO DATA AVA=
ILABLE&lt;/span&gt;";<BR>&nbsp;&nbsp;&nbsp;&nbsp;//break;<BR>&nbsp;&nbsp;=
&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;$min_x =3D $min_x=
-$distancia;<BR>&nbsp;&nbsp;$max_x =3D $max_x+$distancia;<BR>&nbsp;&nbsp;=
$min_y =3D $min_y- $distancia;<BR>&nbsp;&nbsp;$max_y=3D$max_y+$distancia;=
<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;$_SESSION["miMap"]-&gt;setextent($min_x,$=
min_y,$max_x,$max_y);<BR>&nbsp;&nbsp;$_SESSION['noinfo']=3D"";<BR>&nbsp;}=
else{<BR>&nbsp;&nbsp;$_SESSION['noinfo']=3D" &lt;span class=3D'greysmalle=
r'&gt;NO DATA AVAILABLE&lt;/span&gt;";<BR>&nbsp;}<BR>&nbsp;$_SESSION['map=
_extent']=3D $_SESSION["miMap"]-&gt;extent-&gt;minx." ".$_SESSION["miMap"=
]-&gt;extent-&gt;miny." "<BR>&nbsp;.$_SESSION["miMap"]-&gt;extent-&gt;max=
x." ".$_SESSION["miMap"]-&gt;extent-&gt;maxy;<BR>&nbsp;<BR>}<BR></DIV>
<DIV>Sorry for my english, hope you use it.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards,</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D1>Marcelo Ismael Carrillo Est=E9vez</FON=
T></DIV>
<DIV><FONT face=3DVerdana size=3D1>BAYTEQ C=EDa. Ltda.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D1>09-8813885</FONT><FONT face=3DVerdana =
size=3D1></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D1>"There's no place like 127.0.0.1"</FON=
T></DIV>
<DIV id=3DIncrediOriginalMessage><I>-------Mensaje original-------</I></D=
IV>
<DIV>&nbsp;</DIV>
<DIV id=3Dreceivestrings>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>De:</B></I> <A href=3D"mai=
lto:mapserver at lparchaeology.com">mapserver at lparchaeology.com</A></DIV>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>Fecha:</B></I> 26/07/2004 =
8:39:21</DIV>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>Para:</B></I> <A href=3D"m=
ailto:mapserver-users at lists.gis.umn.edu">Mapserver Users</A></DIV>
<DIV dir=3Dltr style=3D"FONT-SIZE: 11pt" <i><B>Asunto:</B></I> [Mapserver=
-users] Center map on feature?</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>I would like to ask the list for any ideas about how I can centre a =
map</DIV>
<DIV>on a specific site/feature.</DIV>
<DIV>&nbsp;</DIV>
<DIV>We currently link from a site result page (generated from a database=
) to</DIV>
<DIV>a map search page by grabbing the X,Y UTM zone 33 values for the sit=
e</DIV>
<DIV>that we hold in the database. e.g. reference map&nbsp;&nbsp;link on =
page:</DIV>
<DIV>&nbsp;</DIV>
<DIV><A href=3D"http://www.fastionline.org/php/content.php?item=3D4&amp;s=
ite_id=3D80&amp;lang=3Dit">http://www.fastionline.org/php/content.php?ite=
m=3D4&amp;site_id=3D80&amp;lang=3Dit</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>will take you to the main map page centred on the site.</DIV>
<DIV>&nbsp;</DIV>
<DIV>However, we have recently begun to add sites that are in UTM zone 32=
=2E We</DIV>
<DIV>project all this very neatly using mapserver. However, we need to th=
ink</DIV>
<DIV>of a new way to link back from a single site to the main map centred=
 on</DIV>
<DIV>the site.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Any suggestions would be very welcome. Every site has a unique id wh=
ich</DIV>
<DIV>is also present in our shapefile.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Many thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Guy</DIV>
<DIV>&nbsp;</DIV>
<DIV>--</DIV>
<DIV>Guy Hunt</DIV>
<DIV>&nbsp;</DIV>
<DIV>L - P : Archaeology</DIV>
<DIV><A href=3D"http://www.lparchaeology.com">www.lparchaeology.com</A></=
DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>--</DIV>
<DIV>Guy Hunt</DIV>
<DIV>&nbsp;</DIV>
<DIV>L - P : Archaeology</DIV>
<DIV><A href=3D"http://www.lparchaeology.com">www.lparchaeology.com</A></=
DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>_______________________________________________</DIV>
<DIV>Mapserver-users mailing list</DIV>
<DIV><A href=3D"mailto:Mapserver-users at lists.gis.umn.edu">Mapserver-users=
@lists.gis.umn.edu</A></DIV>
<DIV><A href=3D"http://lists.gis.umn.edu/mailman/listinfo/mapserver-users=
">http://lists.gis.umn.edu/mailman/listinfo/mapserver-users</A></DIV></TD=
></TR>
<TR>
<TD id=3DINCREDIFOOTER width=3D"100%">
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%">
<TBODY>
<TR>
<TD width=3D"100%"></TD>
<TD id=3DINCREDISOUND vAlign=3Dbottom align=3Dmiddle></TD>
<TD id=3DINCREDIANIM vAlign=3Dbottom align=3Dmiddle></TD></TR></TBODY></T=
ABLE></TD></TR></TBODY></TABLE></BOD html Font: Body: Font-Siz< Arial></B=
ODY></HTML>
--------------Boundary-00=_WFPGLVC0000000000000--

--------------Boundary-00=_WFPGQL80000000000000
Content-Type: Image/jpeg;
  name="classic_border03.jpg"
Content-ID: <64210532-B54A-498F-A3A2-890DD117595A>
Content-Transfer-Encoding: base64

/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAMgAA/+4ADkFkb2JlAGTAAAAAAf/b
AIQACAYGBgYGCAYGCAwIBwgMDgoICAoOEA0NDg0NEBEMDg0NDgwRDxITFBMSDxgYGhoYGCMiIiIj
JycnJycnJycnJwEJCAgJCgkLCQkLDgsNCw4RDg4ODhETDQ0ODQ0TGBEPDw8PERgWFxQUFBcWGhoY
GBoaISEgISEnJycnJycnJycn/8AAEQgAHQSwAwEiAAIRAQMRAf/EAHYAAQEBAQEBAAAAAAAAAAAA
AAABAgMEBwEBAQEBAQAAAAAAAAAAAAAAAAECAwUQAAEDAwMDBQACAwEBAQAAAAEAESExQVFhcYHw
kaGxwdHhAhIiMkID8XKCEQEAAwEAAgMBAAAAAAAAAAAAARFBIWFx8DFRgf/aAAwDAQ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Z
mcqnV1Nnr1RSVUHsgo5TLuyD/I5uqhBL9VV0NH4S9umS8qeg4iyjDO+yCzKz8O60IaztdILoPOqo
fXmiggLn2Vj/ABymfChaXpo6oHvkIXLy4urjZDqsyDAzhRx9J+bZQU41VAywasFVoYqBtHZX89Vd
N6I/OiZJhC7f243T9fyeMqKOB8oC32nUuga/Wyd4hIfCHSGUHD2VNR5xyrcqGiCKOpDB63WjVEH8
2qp6lDUb+6Hxr5SQPRRzuhoMKy8VQRoe/qrLV7pbWKKZZUNM3VGC/KS00ZSJeigTQbShnb4Qu0Uu
mFFBtS6D7SfMYUDPFfPlPwVjD3uoXF7eVTX5+1ZY1ShHesq3JZSL8JLh8B++iqKKgDd0kxbKQ589
FDQ9eqYJL/OtUDyO6Gpwh8+6C0ByoXJnbugr2T9PfllJUrNWhAcxyheeXZAzxRoVRdKZWQLszOVT
q6mz16opKqD2QUcpl3ZB/kc3VQgl+qq6Gj8Je3TJeVPQcRZRhnfZBZlZ+HdaENZ2ukF0HnVUPrzR
QQFz7Kx/jlM+FC0vTR1QO+90s1mlXGyXhZ0Qm4vVDf04SGGWuktdUUHjKHOLlZli+bqlm1dBWbRS
xtlBpxuhdg3W6ARgowF3Pwh1pKC7Uupqv//Z

--------------Boundary-00=_WFPGQL80000000000000--



More information about the mapserver-users mailing list