load_states.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:geodjango-tigerleaflet 作者: jlillest 项目源码 文件源码
def handle(self, *args, **kwargs):
        path = kwargs['path']

        # With DEBUG on this will DIE.
        settings.DEBUG = False

        # figure out which path we want to use.
        years = ["2016", "2015", "2014", "2013", "2012", "2011"]
        directories = [('tl_%s_us_state' % year, year) for year in years]

        tiger_file = ""
        for (directory, year) in directories:
            if os.path.exists(os.path.join(path, directory)):
                print('Found %s files.' % year)
                tiger_file = os.path.join(path, directory + "/" + directory + ".shp")
                break

        if not tiger_file:
            print('Could not find files.')
            exit()

        print("Start States: %s" % datetime.datetime.now())
        state_import(tiger_file, year)
        print("End States: %s" % datetime.datetime.now())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号