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 8849471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:39:41+00:00 2026-06-14T12:39:41+00:00

I am trying to provide walking directions on campus between buildings. When I use

  • 0

I am trying to provide walking directions on campus between buildings. When I use the following code, the start and end coordinates get placed on the nearest named road rather than the specific path that was specified.

    var request = {
    origin: "34.23974770397957,-118.53099968624116",
        destination: "34.240064785369974,-118.52827992630006",
        travelMode: google.maps.DirectionsTravelMode.WALKING
    };
    directionsService = new google.maps.DirectionsService();
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);
      }
    });

You can see the problem here http://www.csun.edu/~kjm39451/maps/mapsError/main.html by selecting the drop down for anything in both fields.

But I want the result to look like this https://maps.google.com/maps?saddr=34.23974770397957,-118.53099968624116&daddr=34.240064785369974,-118.52827992630006&hl=en&ll=34.239825,-118.530614&spn=0.003721,0.004823&sll=34.23962,-118.52964&sspn=0.003721,0.004823&geocode=FQR1CgIdSFzv-A%3BFUF2CgId6Gbv-A&dirflg=w&mra=ls&t=m&z=18

How can I use google maps api to give directions just like google maps does?

  • 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-06-14T12:39:42+00:00Added an answer on June 14, 2026 at 12:39 pm

    The destination and origin properties of DirectionsRequest can either take a string or a LatLng class. If you supply a LatLng it seems to be working.

    var request = {
      origin: new google.maps.LatLng(34.23974770397957, -118.53099968624116),
      destination: new google.maps.LatLng(34.240064785369974, -118.52827992630006),
      travelMode: google.maps.DirectionsTravelMode.WALKING
    };
    

    You can refer to the maps API documentation:
    https://developers.google.com/maps/documentation/javascript/3.exp/reference#DirectionsRequest

    https://developers.google.com/maps/documentation/javascript/reference#LatLng

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

Sidebar

Related Questions

trying to refactor code to provide clean association A GAME has a HOME_TEAM and
I'm trying to use ThreadLocal to provide thread safety to pre-existing non-thread-safe classes, but
I'm trying to use fixtures in Django to provide some initial data to one
I am trying to provide an option to switch between webcams used to display
I'm trying to provide a link to the attachment of a note through the
I am trying to provide a simple RESTful API to my ASP MVC project.
I am trying to provide an interface to an abstract generic base class. I
This is the situation. I'm trying to provide a service where someone embedds an
I'm trying to unmarshall some dozer mapping files in order to provide a mapping
I am trying to aggregate several queries together to provide a latest updates display

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.