On Apr 1, 1:58 pm, Ashwin <[email protected]> wrote: > hi, > > Am fetching the latitude and longitude from my table and plotting them > as marker in google maps just as in my below code. Here am > experiencing a problem, whenever i double click on the map to change > the zoom level or use the zoom level changer (navigation control), My > markers places are disturbed and it is placed in some other place in > the map.. i need to have the zoom level change option as well along > with plotting the markers at the right place....how to achieve this? > > code is as below.. >
No, thanks! Please read and follow the group's posting guidelines: http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/2b3f101fd509919e# http://groups.google.com/group/Google-Maps-API/web/why-including-a-link-is-critical -- Marcelo - http://maps.forum.nu -- > <div id="map" style="width: 675px; height: 450px; float:left; border: > 1px solid black;"></div> > > <script type="text/javascript" src="/js/label.js"></script> > <script type="text/javascript"> > > /** > * map > */ > var mapOpts = { > mapTypeId: google.maps.MapTypeId.ROADMAP, > scaleControl: true, > scrollwheel: false} > > var map = new google.maps.Map(document.getElementById("map"), > mapOpts); > // We set zoom and center later by fitBounds() > > /** > * creates Marker and InfoWindow on a Map() named 'map' > * saves marker to markerArray and markerBounds > * @param options object for Marker and InfoWindow > * @author Esa 2009 > */ > var infoWindow = new google.maps.InfoWindow(); > var markerBounds = new google.maps.LatLngBounds(); > var markerArray = []; > > function makeMarker(options){ > var pushPin = new google.maps.Marker({map:map}); > pushPin.setOptions(options); > google.maps.event.addListener(pushPin, "click", function(){ > infoWindow.setOptions(options); > infoWindow.open(map, pushPin); > }); > markerBounds.extend(options.position); > markerArray.push(pushPin); > return pushPin; > > } > > google.maps.event.addListener(map, "click", function(){ > infoWindow.close(); > > }); > > var label = new Label({ > map: map > }); > > /** > * markers and info window contents > */ > > <% > > If rsMSCheck.eof then > MU_COM_Err="MSISDN Not available." > > Else > last_row_no=Cint(rsHistory1("cnt")) > 'response.write last_row_no > JSCoordinatesArray = "var flightPlanCoordinates = [" > do until rsHistory.eof > %> > makeMarker({ > position: new google.maps.LatLng(<%= rsHistory( > "latit" ) %>,<%= > rsHistory( "longit" ) %>), > title:"<%=rsHistory( "SlNo" ) %>" > }); > var latLng = new google.maps.LatLng(<%= rsHistory( "latit" ) %>,<%= > rsHistory( "longit" ) %>); > var marker = new google.maps.Marker({ > position: latLng, > draggable: false, > title:"<%=rsHistory( "SlNo" )%>: < > %=rsHistory( "MSG_DATE_INFO" ) %>", > map: map > }); > > var label = new Label({ > map: map > }); > label.bindTo('position', marker, 'position'); > label.set('text','<%=rsHistory( "SlNo" ) %>'); > > <% > If CInt(rsHistory( "SlNo" )) < last_row_no then > > JSCoordinatesArray=JSCoordinatesArray & "new > google.maps.LatLng(" & rsHistory( "latit" )&"," & > rsHistory( "longit" ) &")," > > Else > > JSCoordinatesArray=JSCoordinatesArray & "new > google.maps.LatLng(" & rsHistory( "latit" )&"," & > rsHistory( "longit" ) &")" > > End If > rsHistory.movenext > loop > JSCoordinatesArray=JSCoordinatesArray & "];" > End If > > %> > > <%= JSCoordinatesArray %> > > var flightPath = new google.maps.Polyline({ > path: flightPlanCoordinates, > strokeColor: "#FF0000", > strokeOpacity: 1.0, > strokeWeight: 2 > }); > > flightPath.setMap(map); > > /** > * fit markers to viewport > */ > map.fitBounds(markerBounds); > > </script> -- 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.
