日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python提取图片gps坐标_用python从.docx文件中提取GPS坐标

發布時間:2023/12/18 python 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python提取图片gps坐标_用python从.docx文件中提取GPS坐标 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

如果有不同模式的文件,我不知道這是否有效(請注意,我使用的是python 2.7.11):# -*- coding: utf-8 -*-

from docx import Document

import sys

import os

import re

reload(sys)

sys.setdefaultencoding('utf8')

for root, dirs, files in os.walk("."):

for name in files:

doc_file = os.path.join(root, name)

if doc_file.endswith('docx'):

main_file = Document(doc_file)

table = main_file.tables[1] # this is same for every document

data = []

keys = None

for i, row in enumerate(table.rows):

text = (cell.text for cell in row.cells)

if i == 0:

keys = tuple(text)

continue

row_data = tuple(text)

data.append(row_data)

regexReference = re.compile("(C.-[0-9-]+)")

regexCoordinate = re.compile(r'(N-(.{,12})([0-9]|\')|[0-9].{,12}N)[;, ]+(E-(.{,12})([0-9]|\')|[0-9].{,12}E)')

result = []

for item in data:

tmp = dict()

matchReference = regexReference.search(item[1])

matchCoordinate = regexCoordinate.search(unicode(item[2]))

if matchReference:

tmp['reference'] = matchReference.group()

if matchCoordinate:

tmp['x'] = matchCoordinate.group(1)

tmp['y'] = matchCoordinate.group(4)

tmp['description'] = unicode(item[2])

tmp['location'] = unicode(item[3])

result.append(tmp)

for rs in result:

if 'reference' in rs:

for k, v in rs.iteritems():

print('{} = {}'.format(k, v))

print

# Output:

#

# y = 91°38'28.2"E

# x = 22°40'34.3"N

# description = The existing CMC Office at Bariyodhala (22°40'34.3"N; 91°38'28.2"E) requires some repair/maintenance works including electrical wiring and electrical lights and appliances like ceiling fans supplies. Detail specification of the works are attached.

# reference = C1-20701-17-1

# location = xxxxx Site, c Region

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的python提取图片gps坐标_用python从.docx文件中提取GPS坐标的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。