91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

使用Python編寫的坐標投影轉換,需要輸入的是源數據的EPSG代號和目標數據的EPSG代號,具體說明文檔見文件夾內

資源截圖

代碼片段和文件信息

#?-*-?encoding:?utf-8?-*-
import?urlliburllib2
import?requests
import?json
import?os
def?convert(xys_srst_srs):
????url=‘http://epsg.io/trans‘
????textmod?={‘x‘:x‘y‘:y‘s_srs‘:s_srs‘t_srs‘:t_srs}
????textmod?=?urllib.urlencode(textmod)
????print(textmod)
????#輸出內容:password=admin&user=admin
????req?=?urllib2.Request(url?=?‘%s%s%s‘?%?(url‘?‘textmod))
????print(req.get_full_url())
????res?=?urllib2.urlopen(req)
????res?=?res.read()
????print(res)
def?request(datas_srst_srs):
????url=‘http://epsg.io/trans‘
????textmod?={‘data‘:data‘s_srs‘:s_srs‘t_srs‘:t_srs}
????response?=?requests.get(url?params=textmod)
????jsonData?=?response.json()
????coor=json.dumps(jsonData)
????return?coor
????#?print(json)
#?遍歷指定目錄,顯示目錄下的所有文件名
def?eachFile(filepath):
????pathDir?=??os.listdir(filepath)
????for?allDir?in?pathDir:
????????child?=?os.path.join(‘%s%s‘?%?(filepath?allDir))
????????childPath=child.decode(‘gbk‘)?#?.decode(‘gbk‘)是解決中文顯示亂碼問題
????????with?open(childPath?‘r‘)?as?file:
????????????json_data?=?file.read()
????????????json_data?=?json.loads(json_data)
????????????s_srs=json_data[‘s_srs‘]
????????????t_srs=json_data[‘t_srs‘]
????????????cdata=json_data[‘data‘]
????????????coor=request(cdatas_srst_srs)
????????????outPutPath=os.path.splitext(childPath)[0]+‘Convert.txt‘
????????????with?open(outPutPath?‘w‘)?as?wfile:
????????????????geojson=json.dumps(coor)
????????????????geojson.replace(‘u\‘‘‘\‘‘)
????????????????geojson=geojson.decode(“unicode-escape“)?
????????????????wfile.write(geojson)
????????????????print(‘success‘)
def?readFile():
????path=os.path.dirname(os.path.realpath(__file__))#獲取py文件所在文件夾
????txtDirPath=path+‘\\txt\\‘
????eachFile(txtDirPath)
def?reptile():
????url=‘http://epsg.io/trans?y=2544675&x=36518161&t_srs=4326&s_srs=2360‘
????page?=?urllib.urlopen(url)
????return?page.read()
if?__name__==‘__main__‘:
????#?request(36518161254467523604326)
????readFile()

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-11-14?16:03??根據epsg代號進行坐標批量轉換\ConvertByEpsg\
?????文件????????2056??2018-08-22?15:55??根據epsg代號進行坐標批量轉換\ConvertByEpsg\convert.py
?????目錄???????????0??2018-11-14?16:03??根據epsg代號進行坐標批量轉換\ConvertByEpsg\txt\
?????文件??????????69??2018-08-22?15:45??根據epsg代號進行坐標批量轉換\ConvertByEpsg\txt\demoData.txt
?????文件?????????143??2018-08-22?15:59??根據epsg代號進行坐標批量轉換\ConvertByEpsg\說明.txt

評論

共有 條評論