howto calculate a distance between 2 cities ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nisha chaudhary
    New Member
    • Apr 2010
    • 5

    howto calculate a distance between 2 cities ?

    i am working on project of online courier service and i have to calculate distance between 2 cities .how i can calculate distance between 2 cities using jsp code?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    JSP has nothing common with JavaScript ... even though you might use JavaScript for such a task by making a google routeplanning request with an AJAX call to retrieve the distance. I think you could even do that serverside with JSP ... but in both cases ... you would need to call a geo-service to get that distance.

    regards

    Comment

    • RedSon
      Recognized Expert Expert
      • Jan 2007
      • 4980

      #3
      Oh, I was going to say add the squares of the difference between the two points X and Y positions and then take the square root of that, and you will have an approximate distance.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        hmmm ... of course ... you could even try with the linear line ... . but it wouldn't consider any special conditions like a river between the places or similar where you would have to go miles more to reach a brigde to cross it ... i guess for a courier service that might be important ... especially when that is going to be the base for tour-planner ... a map-service would consider most of such conditions ...

        kind regards

        Comment

        • RedSon
          Recognized Expert Expert
          • Jan 2007
          • 4980

          #5
          Well we need to find out if this is a theoretical question, or one for an actual enterprise product?

          Comment

          • nisha chaudhary
            New Member
            • Apr 2010
            • 5

            #6
            Originally posted by gits
            JSP has nothing common with JavaScript ... even though you might use JavaScript for such a task by making a google routeplanning request with an AJAX call to retrieve the distance. I think you could even do that serverside with JSP ... but in both cases ... you would need to call a geo-service to get that distance.

            regards
            thnks.but how to get that geo service to calculate

            Comment

            • nisha chaudhary
              New Member
              • Apr 2010
              • 5

              #7
              will u provide me code for finding out distance

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5390

                #8
                you would need to use a map-service in case you want to that. for a start have a look here for example ... and here for the API reference.

                Comment

                Working...