栅格和世界文件导入ArcGis,地图单位是什么?
简而言之:我以为地图上的单位是米或者公里,但这似乎不对。它们是十进制度数吗?在ArcGIS中可以设置这个选项吗?
你好,
我正在和一位研究人员合作,使用ArcGIS将一些计算机视觉图像叠加到地图上。我创建了一个世界文件来测试在ArcGIS中导入栅格图像,但我似乎在缩放上搞错了。
我为一张1600x1600像素的图像创建了一个jgw文件,这张图应该覆盖一个8米乘8米的正方形。我已经成功地将它定位和旋转正确,但缩放却完全不对。
0.005
0.0013043484005
0.00482687012982
-0.005
10.8090421
59.5502261
更新:我尝试随机缩小图像,并把这个文件发给了我的同事(注意我在第1行和第4行的数字小数点后面输入错了):
0.00000005
0.000000013043484005
0.0000000482687012982
-0.00000005
10.8090421
59.5502261
结果图像看起来像这样,离我想要的效果更近了。
我使用一个简单的Python脚本创建了这个jgw文件,脚本读取了一个包含角落位置的csv文件。
CSV输入文件:
Prosjekt,Felt,Kornart,Season,Date_image,BildeID,RuteID,OmtrentligHimmelretning,Hjorne,Koordinat-system,Latitude,Longitude
Multisens,Garder,SW,Harvest,30/08/2012,902,10,se,NedreHoyre,WGS-84,59.5501946,10.8092326
Multisens,Garder,SW,Harvest,30/08/2012,902,10,sw,NedreVenstre,WGS-84,59.5501637,10.809107
Multisens,Garder,SW,Harvest,30/08/2012,902,10,nw,OvreVenstre,WGS-84,59.5502261,10.8090421
Multisens,Garder,SW,Harvest,30/08/2012,902,10,ne,OvreHoyre,WGS-84,59.5502595,10.8091657
Python脚本:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def main():
data = pd.read_csv('pos.csv',header=0)
# Latitude is Y and longitude is X
# The corners are denoted as:
# a ----- b
# | |
# | |
# c ----- d
hjorne = data['Hjorne']
lat = data['Latitude']
lon = data['Longitude']
a = {
'lat': lat[ np.where(hjorne=='OvreVenstre')[0][0] ],
'lon': lon[ np.where(hjorne=='OvreVenstre')[0][0] ]
}
b = {
'lat': lat[ np.where(hjorne=='OvreHoyre')[0][0] ],
'lon': lon[ np.where(hjorne=='OvreHoyre')[0][0] ]
}
c = {
'lat': lat[ np.where(hjorne=='NedreVenstre')[0][0] ],
'lon': lon[ np.where(hjorne=='NedreVenstre')[0][0] ]
}
d = {
'lat': lat[ np.where(hjorne=='NedreHoyre')[0][0] ],
'lon': lon[ np.where(hjorne=='NedreHoyre')[0][0] ]
}
print a , b , c, d
# Pixels per meter is 1600 per 8 m
mPerPix = 8 / 1600.0
scalex = mPerPix
scaley = -mPerPix
# The skew rate is sin( image width ) [m/px]
rotationAngle = np.arctan2( b['lat'] - a['lat'], b['lon'] - a['lon'])
skewY = np.sin( rotationAngle ) * mPerPix
skewX = np.cos( rotationAngle ) * mPerPix
print rotationAngle
outfile = open('output.jgw','w')
# Line 1: A: pixel size in the x-direction in map units/pixel
# Line 2: D: rotation about y-axis
# Line 3: B: rotation about x-axis
# Line 4: E: pixel size in the y-direction in map units, almost always negative[3]
# Line 5: C: x-coordinate Longitude of the center of the upper left pixel
# Line 6: F: y-coordinate Latitude of the center of the upper left pixel
outfile.write( '{}\n{}\n{}\n{}\n{}\n{}\n'.format(
scalex, skewY, skewX, scaley, a['lon'], a['lat']))
outfile.close()
1 个回答
0
简单来说:我原以为地图上的单位是米或者公里,但这似乎不对。那它们是十进制度数吗?在ArcGis中可以设置这个选项吗?
看看你第一张图片的左下角。很明显,地图单位是十进制度数。地图单位取决于坐标系统,通常如果你使用的是地理坐标系统,比如(WGS84),那么单位就是度数;如果你使用的是投影坐标系统,那么单位就是米或其他单位。
如果你需要以米为单位的角落坐标,可以把你的参考点(或者你想用来提取米坐标的图层)转换成你所在国家使用的投影坐标系统。你可以在Arcgis中使用“Project”或者“Project raster”工具来完成这个操作。