【问题标题】:Time Calculation between two latitudes and longitudes respectively?分别计算两个纬度和经度之间的时间?
【发布时间】:2014-10-20 09:28:21
【问题描述】:

在android中不使用JSON解析可以计算两个经纬度之间的时间吗?

【问题讨论】:

  • Swetha,你的意思是?你的问题很不清楚。
  • 你的问题很不清楚。 JSON和纬度/经度之间有什么关系?你指的是什么?
  • 输入和预期输入的样本将有助于使这一点更清晰......
  • 他可能想知道如何计算从 JSON 格式的地理位置 API 接收到的纬度和经度
  • 时间 1(坐标 1) - 时间 2(坐标 2)= 请求时间

标签: java android


【解决方案1】:

您可以使用一些网络服务来查询某个位置的时区。就像earthtools.org 提供的那样,用于获取特定纬度和经度的时区。例如。查询:

http://www.earthtools.org/timezone/40.71417/-74.00639

将返回以下 XML 响应:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<timezone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.earthtools.org/timezone.xsd">
    <version>1.1</version>
    <location>
        <latitude>40.71417</latitude>
        <longitude>-74.00639</longitude>
    </location>
    <offset>-5</offset>
    <suffix>R</suffix>
    <localtime>4 Dec 2005 12:06:56</localtime>
    <isotime>2005-12-04 12:06:56 -0500</isotime>
    <utctime>2005-12-04 17:06:56</utctime>
    <dst>False</dst>
</timezone>

【讨论】:

    【解决方案2】:

    您可以使用 Google Map 的 API 获取某个地点的时区。

    以下网址可能返回纬度为lati,经度为long的地方的时区。

    https://maps.googleapis.com/maps/api/timezone/xml? location=lati,long
    

    两地之间的时间是它们所在时区的差异,可以按照以下步骤计算。

    1. get timezone of one place by using Google Maps's API
    2. get timezone of another place by using Google Maps's API
    3. calculate difference of two timezones.
    

    【讨论】:

      猜你喜欢
      • 2014-04-10
      • 1970-01-01
      • 2018-06-11
      • 2019-07-19
      • 2011-09-16
      • 1970-01-01
      • 2012-10-13
      • 2012-11-22
      • 1970-01-01
      相关资源
      最近更新 更多