两个纬度和经度之间的时间计算?

时间:2014-10-20 09:28:22

标签: java android

我们可以在不使用Android中的JSON解析的情况下计算两个纬度和经度之间的时间吗?

2 个答案:

答案 0 :(得分:0)

您可以使用某些Web服务查询某个位置的时区。与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>

答案 1 :(得分:0)

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

以下网址可能会返回纬度为lati且经度较长的地方的时区。

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.
相关问题