• <i id='eLemf'><tr id='eLemf'><dt id='eLemf'><q id='eLemf'><span id='eLemf'><b id='eLemf'><form id='eLemf'><ins id='eLemf'></ins><ul id='eLemf'></ul><sub id='eLemf'></sub></form><legend id='eLemf'></legend><bdo id='eLemf'><pre id='eLemf'><center id='eLemf'></center></pre></bdo></b><th id='eLemf'></th></span></q></dt></tr></i><div id='eLemf'><tfoot id='eLemf'></tfoot><dl id='eLemf'><fieldset id='eLemf'></fieldset></dl></div>

    <small id='eLemf'></small><noframes id='eLemf'>

      <tfoot id='eLemf'></tfoot>

    1. <legend id='eLemf'><style id='eLemf'><dir id='eLemf'><q id='eLemf'></q></dir></style></legend>
        <bdo id='eLemf'></bdo><ul id='eLemf'></ul>

        从经纬度坐标获取时区?

        时间:2023-07-04

      1. <i id='554e0'><tr id='554e0'><dt id='554e0'><q id='554e0'><span id='554e0'><b id='554e0'><form id='554e0'><ins id='554e0'></ins><ul id='554e0'></ul><sub id='554e0'></sub></form><legend id='554e0'></legend><bdo id='554e0'><pre id='554e0'><center id='554e0'></center></pre></bdo></b><th id='554e0'></th></span></q></dt></tr></i><div id='554e0'><tfoot id='554e0'></tfoot><dl id='554e0'><fieldset id='554e0'></fieldset></dl></div>
            <tbody id='554e0'></tbody>
          <legend id='554e0'><style id='554e0'><dir id='554e0'><q id='554e0'></q></dir></style></legend>

            • <tfoot id='554e0'></tfoot>

                <bdo id='554e0'></bdo><ul id='554e0'></ul>

                <small id='554e0'></small><noframes id='554e0'>

                  本文介绍了从经纬度坐标获取时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试获取纬度和经度坐标的时区,但遇到了一些问题这些错误可能是非常基本的

                  I am trying to get the time zones for latitude and longitude coordinates but am having a few problems The mistakes are probably very basic

                  我在数据库中有一个大约 600 行的表.每行包含世界某处的经纬度坐标我想将这些坐标输入一个函数,然后检索时区.目的是将在这 600 个地点中的每个地点具有本地时间戳的事件转换为 UTC 时间

                  I have a table in a database with around 600 rows. Each row contains a lat long coordinate for somewhere in the world I want to feed these co-ordinates into a function and then retrieve the time zone. The aim being to convert events which have a local time stamp within each of these 600 places into UTC time

                  我发现了一篇博文使用一段代码从地理坐标导出时区.

                  I found a blog post which uses a piece of code to derive timezones from geographical coordinates.

                  当我尝试运行代码时,我收到错误geonames is not defined.我已经申请了一个带有地名的帐户.

                  When I try to run the code, I get the error geonames is not defined. I have applied for an account with geonames.

                  我想我只是将函数文件保存在错误的目录中或一些简单的东西.谁能帮忙

                  I think I have just saved the function file in the wrong directory or something simple. Can anyone help

                  #-------------------------------------------------------------------------------
                  # Converts latitude longitude into a time zone
                  # REF: https://gist.github.com/pamelafox/2288222
                  # REF: http://blog.pamelafox.org/2012/04/converting-addresses-to-timezones-in.html
                  #-------------------------------------------------------------------------------
                  
                  geonames_client = geonames.GeonamesClient('Username_alpha')
                  geonames_result = geonames_client.find_timezone({'lat': 48.871236, 'lng': 2.77928})
                  user.timezone = geonames_result['timezoneId']
                  

                  推荐答案

                  这按预期工作:

                  import geonames
                  geonames_client = geonames.GeonamesClient('demo')
                  geonames_result = geonames_client.find_timezone({'lat': 48.871236, 'lng': 2.77928})
                  print geonames_result['timezoneId']
                  

                  输出:

                  'Europe/Paris'
                  

                  这篇关于从经纬度坐标获取时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Django:如何让 datetime 对象知道创建它的时区? 下一篇:确定当天的开始和结束时间(UTC -> EST -> UTC);Python

                  相关文章

                  1. <tfoot id='j2IfN'></tfoot>
                      <legend id='j2IfN'><style id='j2IfN'><dir id='j2IfN'><q id='j2IfN'></q></dir></style></legend>
                        <bdo id='j2IfN'></bdo><ul id='j2IfN'></ul>

                      <i id='j2IfN'><tr id='j2IfN'><dt id='j2IfN'><q id='j2IfN'><span id='j2IfN'><b id='j2IfN'><form id='j2IfN'><ins id='j2IfN'></ins><ul id='j2IfN'></ul><sub id='j2IfN'></sub></form><legend id='j2IfN'></legend><bdo id='j2IfN'><pre id='j2IfN'><center id='j2IfN'></center></pre></bdo></b><th id='j2IfN'></th></span></q></dt></tr></i><div id='j2IfN'><tfoot id='j2IfN'></tfoot><dl id='j2IfN'><fieldset id='j2IfN'></fieldset></dl></div>

                      <small id='j2IfN'></small><noframes id='j2IfN'>