On Jun 8, 8:24 am, Shaliko <[email protected]> wrote: > When I create Gmap she needed to establish the center and zoom > > Because of this route is not positioned at the center - this is an > examplehttp://grab.by/4OD6
Why a picture? Why not a link to your map as requested in the posting guidelines? > > How get a zoom which displays my polyline objects map? GLatLngBounds.extend http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds with all the points in the polyline would be one suggestion. -- Larry > > My code: > > var TrainingGMap = Class.create({ > initialize: function(div_id, points, options) { > this.options = Object.extend({}, options) > this.points = points; > var latlng = new google.maps.LatLng(this.points[0].lan, > this.points[0].lon); > this.map = new google.maps.Map(document.getElementById(div_id), { > zoom: 12, > center: latlng, > mapTypeId: google.maps.MapTypeId.ROADMAP > }); > > var line = new Array(); > for (var i = 0; i < this.points.length; i++) { > line[i] = new google.maps.LatLng(this.points[i].lan, > this.points[i].lon); > } > > var polyline = new google.maps.Polyline({ > path: line, > strokeColor: "#aa0000", > strokeOpacity: 1.0, > strokeWeight: 5 > }); > > polyline.setMap(this.map); > var polylineBounds = new google.maps.LatLngBounds(line.first(), > line.last()); > this.map.setCenter(polylineBounds.getCenter()); > } > > > > });- Hide quoted text - > > - Show quoted text - -- 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.
