The way I think of is that: get all the vertices of a polygon and then loop thought them to get the center x, y, max x, y and min x, y, and then you can define the best zoom level. Here is an example: http://www.dyngeometry.com/web/sample/Zip.html
This Worldwide Region Polygon Object Generator may help you: http://www.dyngeometry.com/web/WorldRegion.aspx On Sep 30, 6:58 am, Pendyshchuk Maxym <[EMAIL PROTECTED]> wrote: > thank you for interesting solution :) > > but how Google did it? when I set default location I get what I need, > so there should be a way... > when I set default location (e.g. to Berlin) I see that google map > sends few requests to the server: > > 1)http://maps.google.com/maps?output=setprefs&near=Berlin&action=ab&hl=en > > snd response is: > {svaddr:"Berlin, Germany",viewport:{center:{lat:52.523479999999999,lng: > 13.411493999999999},span:{lat:0.37080200000000002,lng: > 0.69882900000000003},mapType:""}} > > 2)http://maps.google.com/maps?sidr=9&mid=label:,address:Berlin%252C%252... > > response: > {serial:5,since:3,autoentry:true,startaddress:2,entries:[{id: > 2,address:"Berlin, Germany",label:"",created:1222775355,used: > 1222775355,count:0,serial:5,type:0}],inventory:[1,2]} > > 3)http://maps.google.com/maps/l?stat_m=tiles:1593,1664,1943,2021,2035,1... > > response is empty. > > So take a look at the first request -> reply is waht I need (at least > it seems so) - center and the span... > I just don't know if I can use it :) > there is few parameters: output=setprefs (I'm not sure I need it, but > maybe it will be nice feature) > action=ab - no idea what it is > hl=en - seems like language :) > > hm, I was writing it and thinking - maybe just to try :) > I will post results, but if anyone knows what will be, or another > (better) solution - please post it here :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
