[mapguide-users] Zoom to selection

Kenneth, GEOGRAF A/S ks at geograf.dk
Fri Sep 21 09:25:48 EDT 2007


Thats about how I tried to explain it.
I would derive the object centroid and size by using a combined bbox for 
all objects.

Perhaps I was a bit fuzzy explaining that.

Regards, Kenneth, GEOGRAF A/S



Campbell, Keith A skrev:
> Thanks Kenneth.
>  
> Not sure that I understand that completely, but this is how I have 
> dealt with it:-
>  
> (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)
>  
> * The centroid of the object is calculated
> * The size of the object is queried at the feature source
> * 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.
> * The JavaScript function gets the current map size and scale, and 
> calculates the required scale
> * It then calls the ZoomToView function
>  
> Keith
>  
> ------------------------------------------------------------------------
> *From:* mapguide-users-bounces at lists.osgeo.org 
> [mailto:mapguide-users-bounces at lists.osgeo.org] *On Behalf Of 
> *Kenneth, GEOGRAF A/S
> *Sent:* 21 September 2007 10:46
> *To:* MapGuide Users Mail List
> *Subject:* Re: [mapguide-users] Zoom to selection
>
> I have remarked that it is a problem that the map position (x, y, 
> scale) is not avalible on the server.
> You must manually pass this information from the viewer to your scripts.
>
> 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.
> Using this, you can calculate the height/width ratios and thus get the 
> required width. This width will be in coordinate system units.
>
> How you go from width to scale is dependant on your coordinate system.
> You might send along the current scale, and use that with the window 
> info to calculate a new ratio.
> Regards, Kenneth, GEOGRAF A/S
>   
>
>
> Campbell, Keith A skrev:
>> Kenneth,
>>  
>> 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.
>>  
>> 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).
>>  
>> Keith
>>
>> ------------------------------------------------------------------------
>> *From:* mapguide-users-bounces at lists.osgeo.org 
>> [mailto:mapguide-users-bounces at lists.osgeo.org] *On Behalf Of 
>> *Kenneth, GEOGRAF A/S
>> *Sent:* 21 September 2007 09:09
>> *To:* MapGuide Users Mail List
>> *Subject:* Re: [mapguide-users] Zoom to selection
>>
>> The only way I know of, is to issue a select of the objects on the 
>> datasource.
>> While reading the objects, you can get their envelope (aka mbr, bbox, 
>> etc..).
>> If you sum up alle the objects enevlopes, you can get the minimum 
>> rectangle in which all objects fit.
>> 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.
>> Regards, Kenneth, GEOGRAF A/S
>>   
>>
>>
>> Ivan Milicevic skrev:
>>> 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.
>>>   
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> mapguide-users mailing list
>>> mapguide-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>   
>>
>>
>> This message has been scanned for viruses by MailControl 
>> <http://bluepages.wsatkins.co.uk/?6875772>
>>
>>
>>
>> *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.*
>>
>> 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.
>>
>> P *Consider the environment. Please don't print this e-mail unless 
>> you really need to.*
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>   
>
>
> This message has been scanned for viruses by MailControl 
> <http://bluepages.wsatkins.co.uk/?6875772>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20070921/d47059e6/attachment.html


More information about the mapguide-users mailing list