Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6955599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:45:29+00:00 2026-05-27T14:45:29+00:00

With GMap APi v3 I am using the directions service to generate a route

  • 0

With GMap APi v3 I am using the directions service to generate a route for the user, but once the route is rendered on the map, the target infowindow I placed becomes cropped, as the map is centered on the route, not the target.

How can I tell GM to either:

  1. Automatically focus (or center) on the infowindow, instead of the route
  2. Show the infowindow in a way that it is not cropped (for example: using the tooltip arrow on the top right of the infowindow instead of the lower left, which causes the window to appear on the top right of the route target)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:45:29+00:00Added an answer on May 27, 2026 at 2:45 pm

    I managed to get it done by using .setCenter() within the directionsService callback (after receiving a proper response). However, this only worked when using a timeout. It may not be the purest solution, but it is the only one available to me at the moment.

    /* _x & _y are passed as coordinates */
    var _latLng=new google.maps.LatLng(_x,_y);
    directionsService.route(request, function(response, status) {
        if (status == google.maps.DirectionsStatus.OK) {
            directionsRenderer.setDirections(response);
            window.setTimeout(function(){
                gmap.setCenter(_lagLng);
            }, 500);
        }
    }
    

    It seems that if you call .setCenter() too early, gmap is still building up and once done, centering on the route – thus overriding your last command to .setCenter() – however, using the timeout as a workaround, the call is done after the map is built and the route rendered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Google map API to display map in simple javascript popup. While popup
using jquery-ui-map here is my code $(document).ready(function() {$('#map_canvas').gmap({ 'center': new google.maps.LatLng(3.162456,21.09375), 'zoom': 2, 'streetViewControl':
I'm using the gMap plugin for jQuery. On my map I have several markers.
I am using 'jquery-ui-map' for an android app. My emulator is Google API Level
Am trying to integrate goople map api with a jquery plugin- gMap. It looks
I have an application which is currently using the google map API. I like
I am using gmap and location modules to support my content type's location. I
For simplicity sake, lets use the XML example on Econym's site. http://econym.org.uk/gmap/example_map3.htm Once clicked,
I am using gmap v3. I am facing a problem. The problem is that
I am using the gmap module for Drupal 7 along with location and node

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.