<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>Thanks Kenneth.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>Not sure that I understand that completely, but this is how
I have dealt with it:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>(I needed to generate a list of URLs that will zoom into
the relevant position on the map at a scale based on the size of the
object)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>* The centroid of the object is
calculated</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>* The size of the object is queried at the feature
source</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>* the hyperlinks are created server-side with a call
to a JavaScript function and the required size of the window is passed as a
parameter, plus the centroid x and y.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>* The JavaScript function gets the current map size
and scale, and calculates the required scale</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>* It then calls the ZoomToView function</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2>Keith</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411315912-21092007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <B>On Behalf Of </B>Kenneth,
GEOGRAF A/S<BR><B>Sent:</B> 21 September 2007 10:46<BR><B>To:</B> MapGuide Users
Mail List<BR><B>Subject:</B> Re: [mapguide-users] Zoom to
selection<BR></FONT><BR></DIV>
<DIV></DIV>I have remarked that it is a problem that the map position (x, y,
scale) is not avalible on the server.<BR>You must manually pass this information
from the viewer to your scripts.<BR><BR>The width of the map should be the
maximum width that can display the bbox. To calculate this width, you must know
the browser window width and height.<BR>Using this, you can calculate the
height/width ratios and thus get the required width. This width will be in
coordinate system units.<BR><BR>How you go from width to scale is dependant on
your coordinate system.<BR>You might send along the current scale, and use that
with the window info to calculate a new ratio.<BR><PRE class="moz-signature" defanghtml_cols="72">Regards, Kenneth, GEOGRAF A/S
</PRE><BR><BR>Campbell, Keith A skrev:
<BLOCKQUOTE
cite=mid:2D5D8AC034A54041A6B2AE1C9148CC3106F16397@SGBBMA2102.wsatkins.com
type="cite">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR>
<DIV dir=ltr align=left><SPAN class=197225908-21092007><FONT face=Arial
color=#0000ff size=2>Kenneth,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=197225908-21092007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=197225908-21092007><FONT face=Arial
color=#0000ff size=2>I'm trying to do something similar, and I'm puzzled by
your suggestion that the new scale will be the width or height of the box.
surely there must be a conversion between the current width and scale to get
the new scale? I'm assuming that the zoom-to will be accomplished with the
Viewer API ZoomToView method which requires a scale.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=197225908-21092007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=197225908-21092007><FONT face=Arial
color=#0000ff size=2>What makes this difficult is that he Web API does not
seem to have a method for getting the current view width (map units), as
opposed to display width (pixels).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=197225908-21092007></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=197225908-21092007><FONT face=Arial
color=#0000ff size=2>Keith</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> <A class=moz-txt-link-abbreviated
href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</A>
[<A class=moz-txt-link-freetext
href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</A>]
<B>On Behalf Of </B>Kenneth, GEOGRAF A/S<BR><B>Sent:</B> 21 September 2007
09:09<BR><B>To:</B> MapGuide Users Mail List<BR><B>Subject:</B> Re:
[mapguide-users] Zoom to selection<BR></FONT><BR></DIV>The only way I know of,
is to issue a select of the objects on the datasource.<BR>While reading the
objects, you can get their envelope (aka mbr, bbox, etc..).<BR>If you sum up
alle the objects enevlopes, you can get the minimum rectangle in which all
objects fit.<BR>Once you have this box, your center, will be the center of the
box, and the scale will be the width or height of the box.<BR><PRE class="moz-signature" defanghtml_cols="72">Regards, Kenneth, GEOGRAF A/S
</PRE><BR><BR>Ivan Milicevic skrev:
<BLOCKQUOTE cite=mid:9CAB6B340CCF9E44BE4ACFCF56E67B0705A451@supranet
type="cite"><PRE wrap="">Hello,
I wonder is it possible to calculate zoom extent on selected objects? For example, I have selected various type of objects (line, polygon, point) but I don't have any XY info in database on these objects. How can I calclate center point and scale in this case?
Any help-advices are wellcome.
Greetings,
Ivan.
</PRE><PRE wrap=""><HR width="90%" SIZE=4>
_______________________________________________
mapguide-users mailing list
<A class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org" defanghtml_moz-do-not-send="true">mapguide-users@lists.osgeo.org</A>
<A class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" defanghtml_moz-do-not-send="true">http://lists.osgeo.org/mailman/listinfo/mapguide-users</A>
</PRE></BLOCKQUOTE><BR><BR>
<P align=center><FONT face="Arial, Helvetica, sans-serif" color=#000000
size=2>This message has been scanned for viruses by </FONT><A
href="http://bluepages.wsatkins.co.uk/?6875772"
defanghtml_moz-do-not-send="true"><FONT face="Arial, Helvetica, sans-serif"
color=#000000 size=2>MailControl</FONT></A></P><BR><BR>
<CENTER><FONT face="Arial, Helvetica, sans-serif" size=2><B>This email and any
attached files are confidential and copyright protected. If you are not the
addressee, any dissemination of this communication is strictly prohibited.
Unless otherwise expressly agreed in writing, nothing stated in this
communication shall be legally binding.</B></FONT>
<P><FONT face="Arial, Helvetica, sans-serif" size=2>The ultimate parent
company of the Atkins Group is WS Atkins plc. Registered in England No.
1885586. Registered Office Woodcote Grove, Ashley Road, Epsom, Surrey KT18
5BW.</FONT> </P>
<P><FONT face=Webdings color=green size=5>P</FONT> <FONT
face="Arial, Helvetica, sans-serif" color=green size=2><B>Consider the
environment. Please don't print this e-mail unless you really need
to.</B></FONT> </P></CENTER><PRE wrap=""><HR width="90%" SIZE=4>
_______________________________________________
mapguide-users mailing list
<A class=moz-txt-link-abbreviated href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</A>
<A class=moz-txt-link-freetext href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</A>
</PRE></BLOCKQUOTE><BR><BR>
<P align=center><FONT face="Arial, Helvetica, sans-serif" color=#000000
size=2>This message has been scanned for viruses by </FONT><A
href="http://bluepages.wsatkins.co.uk/?6875772"><FONT
face="Arial, Helvetica, sans-serif" color=#000000
size=2>MailControl</FONT></A></P></BODY></HTML>