English 中文(简体)
两个地址之间的距离
原标题:Distance between two addresses

我在实验室撰写一个图书网站,我需要一个图书馆或一个遥感服务(类似于阿戈图一),计算2个地址之间的距离。

理想的情况是,我更喜欢公路距离,但我对距离何等不关心。

你们能否帮助我?

非常感谢你,欢迎一切帮助。

问题回答

http://code.google.com/apis/maps/documentation/directions/"rel=“noreferer”> 页: 1 这是一个良好的开端。

停止使用URL模式的请求:

http://maps.google.com/maps/api/directions/xml?origin=[FROM_ADDRESS]&destination=[TO_ADDRESS]&sensor=false
// [FROM_ADDRESS] is a Google-Recognisable address for the Start
// [TO_ADDRESS] is a Google-Recognisable address for the End

例——“我是否去卡内基大会堂? (From Son 音乐娱乐)

Start Address: 550 Madison Avenue, New York, NY, United States End Address: 881 7th Avenue, New York, NY, United States

谷歌的XML指示的URL将是

http://maps.google.com/maps/api/directions/xml?origin=550+Madison+Avenue,+New+York,+NY,+United+States&destination=881+7th+Avenue,+New+York,+NY,+United+States&sensor=false

结果是:

<DirectionsResponse>
  <status>OK</status>
  <route>
    <summary>E 57th St</summary>
    <leg>
      <step>
        <travel_mode>DRIVING</travel_mode>
        <start_location>
          <lat>40.7612400</lat>
          <lng>-73.9731300</lng>
        </start_location>
        <end_location>
          <lat>40.7622900</lat>
          <lng>-73.9723600</lng>
        </end_location>
        <polyline>
          <points>wdxwF`{nbMqEyC</points>
          <levels>BB</levels>
        </polyline>
        <duration>
          <value>9</value>
          <text>1 min</text>
        </duration>
        <html_instructions>
          Head <b>northeast</b> on <b>Madison Ave</b> toward <b>E 56th St</b>
        </html_instructions>
        <distance>
          <value>133</value>
          <text>436 ft</text>
        </distance>
      </step>
      <step>
        <travel_mode>DRIVING</travel_mode>
        <start_location>
          <lat>40.7622900</lat>
          <lng>-73.9723600</lng>
        </start_location>
        <end_location>
          <lat>40.7655300</lat>
          <lng>-73.9800500</lng>
        </end_location>
        <polyline>
          <points>ikxwFfvnbMgS`o@</points>
          <levels>BB</levels>
        </polyline>
        <duration>
          <value>148</value>
          <text>2 mins</text>
        </duration>
        <html_instructions>
          Turn <b>left</b> at the 2nd cross street onto <b>E 57th St</b>
        </html_instructions>
        <distance>
          <value>741</value>
          <text>0.5 mi</text>
        </distance>
      </step>
      <step>
        <travel_mode>DRIVING</travel_mode>
        <start_location>
          <lat>40.7655300</lat>
          <lng>-73.9800500</lng>
        </start_location>
        <end_location>
          <lat>40.7651800</lat>
          <lng>-73.9803000</lng>
        </end_location>
        <polyline>
          <points>q_ywFhfpbMdAp@</points>
          <levels>BB</levels>
        </polyline>
        <duration>
          <value>39</value>
          <text>1 min</text>
        </duration>
        <html_instructions>
          Turn <b>left</b> at the 3rd cross street onto <b>7th Ave</b> <div style="font-size:0.9em">Destination will be on the left</div>
        </html_instructions>
        <distance>
          <value>45</value>
          <text>148 ft</text>
        </distance>
      </step>
      <duration>
        <value>196</value>
        <text>3 mins</text>
      </duration>
      <distance>
        <value>919</value>
        <text>0.6 mi</text>
      </distance>
      <start_location>
        <lat>40.7612400</lat>
        <lng>-73.9731300</lng>
      </start_location>
      <end_location>
        <lat>40.7651800</lat>
        <lng>-73.9803000</lng>
      </end_location>
      <start_address>550 Madison Ave, New York, NY 10022, USA</start_address>
      <end_address>881 7th Ave, New York, NY 10019, USA</end_address>
    </leg>
    <copyrights>Map data ©2010 Google, Sanborn</copyrights>
    <overview_polyline>
      <points>wdxwF`{nbMqEyCgS`o@dAp@</points>
      <levels>B@?B</levels>
    </overview_polyline>
  </route>
</DirectionsResponse>

因此,这两点之间最快的路线将详细说明:

  • 第二会期

    DirectionsResponse > Line > leg >dur > Value

  • 文本中的有效期

    DirectionsResponse > Line > leg >dur > text

  • 当地计量单位的距离

    DirectionsResponse > Line > leg >range > Value

  • 地方测量(Miles或Kiles)的Plain文本中的差异

    DirectionsResponse > Line > leg > long > text





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签