luomingjun
路人甲
路人甲
  • 注册日期2005-10-13
  • 发帖数4
  • QQ
  • 铜币116枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1904回复:3

如何编程实现Raster to ASCII?

楼主#
更多 发布于:2005-10-13 15:02
<P>如主题,在ARCMAP里面提供了toolbox可以直接实现Raster to ASCII,我现在需要在AE中实现,如何实现呢?需要各位的帮忙啊,谢谢~</P>
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2005-10-14 12:01
<P>下面是一个程序,不过数据很大的时候,会比较慢</P>
<P>程序可以:转换 raster (GRID or image) 到 ASCII delimited text file of X,Y, and Z values</P>
<P><a href="attachment/2005-10/200510141201798837.rar">2005-10/200510141201798837.rar</a><BR></P>

GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2005-10-14 12:03
<P>另外有个别人写的,听说p4上速度可达到10000个/second,</P><PRE>#
# Asc2XYZ.AWK
# Convert an ESRI ASCII grid to an XYZ Ascii format.
#
# Quantitative Decisions, Merion Station, PA.
#
# 10 Jan 2000
# 5 Jan 2004: Modified to handle long lines.  Status() implemented.
# No error checking.
# Assumes the header portion contains a "nodata_value" record at its end.
# Example of header:
#
#ncols 480
#nrows 450
#xllcorner 378923
#yllcorner 4072345
#cellsize 30
#nodata_value -32768
#---------------------------------------------------------------------------------------------#
BEGIN {
N = -1 # Index of the current data item (will start with 0).
if (ARGC <= 1) {
print "ASC2XYZ v. 1.0, 5 Jan 2004, by Quantitative Decisions." >> "/dev/tty"
print "Converts ESRI ASCII grid files to XYZ ASCII formats." >> "/dev/tty"
print "Usage: ASC2XYZ [name of input file] > [name of output file]" >> "/dev/tty"
exit
}
FALSE = 0
TRUE = !FALSE
OFS = "\t" # Output delimiter
print "X", "Y", "Z"
nDisplayIncrement = 1000
nDisplayLimit = 1000

InData = FALSE
}
#---------------------------------------------------------------------------------------------#
#
# Process the data.
#
InData ;; $0 !~ /^[ \t]*$/ { # We need to skip the last line, which is blank
for (i=1; i<=NF; i++) {
IRow = int((N+i)/ncols)
JCol = N+i - IRow*ncols
X = xllcorner + cellsize*(JCol+0.5)
Y = yllcorner + cellsize*(nrows-0.5-IRow)
Z = $i
print X, Y, Z
}
N+=NF
if (N >= nDisplayLimit) {
Status(N+1); nDisplayLimit = N+nDisplayIncrement
}
next
}
#
# Read the header.
#
{$1 = tolower($1)}
$1 == "ncols" {ncols = $2+0; next}
$1 == "nrows" {nrows = $2+0; next}
$1 == "xllcorner" {xllcorner = $2+0; next}
$1 == "yllcorner" {yllcorner = $2+0; next}
$1 == "cellsize" {cellsize = $2+0; next}
$1 == "nodata_value" {nodata = $2+0
printf("Rows: %9d\nCols: %9d\n", nrows, ncols) >> "/dev/tty"
RS = " " # Treat each field as a record, to avoid limit on NF
InData = TRUE
}
#---------------------------------------------------------------------------------------------#
END {
if (N >= 0) {
Status(N+1)
print "\nDone." >> "/dev/tty"
}
}
#---------------------------------------------------------------------------------------------#
function Status(n) {
printf("\r%9d cells", n) >> "/dev/tty"
} # Status()
### end of file ###</PRE>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
luomingjun
路人甲
路人甲
  • 注册日期2005-10-13
  • 发帖数4
  • QQ
  • 铜币116枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-10-14 12:51
对我来说,真的非常有用,谢谢gis!<img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
游客

返回顶部