On Jan 2, 7:31 am, Julian <[email protected]> wrote: > Hello, > I have many thousand points which describes a polyline on a Google > map. The HTML-File looks like > there:http://code.google.com/intl/de/apis/maps/documentation/javascript/ove... > > I want to make many different polylinemaps. I automaticly convert my > gpx-file into the google html-code. > > My problems are: > 1. How can calculate which zoom level I need to see the hole line? My > website only has a width of 600 pixel. So the map's width also is 600 > pixel. Does Google has an option which automaticly calculate the right > zoom level? Or do I have to calculate the zoom level for my own?
Add all the points in the line to a LatLngBounds object. Call GMap.fitBounds on your map object with that bounds object as its argument. > > 2. Does Google has an option which automaticly calculate the centre of > the polyline? No, although I guess it depends on what you mean by center. If you want to center the polyline on the map you probably want the center of its bounds (see my answer to your first question), that you can do. If you want a point half way along the polyline that is not directly supported but can be calculated. Larry > > Greetings > Julian -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
