Reading Data - 成功大學myweb個人網頁空間服務說明

Download Report

Transcript Reading Data - 成功大學myweb個人網頁空間服務說明

Chapter 1
Reading Data
Analysis and applications of remote
sensing imagery
Instructor: Dr. Cheng-Chien Liu
Department of Earth Sciences
National Cheng Kung University
Last updated: 28 February 2005
Outline
 Digital image format
 Header file
 Map information
 Vector data
Digital image format
 Sequential and interleave
• Band sequential (BSQ)
• Band interleaved by Pixel (BIP)
• Band interleaved by Line (BIL)
 Raster vs. vector
 ENVI image format
• Flat binary file
A binary stream of bytes without embedded non-image data or
structural elements of any type
• Header file
Exercise 1
 Reading known image formats
•
•
•
•
Open external file
Read Flkeys.tif
Load standard false color bands
Explain why changing the view of main image slows
down the display
 Finding the cursor’s location and data value
• Understand the widget of cursor location/value
• Pixel locator
• Determine the pixel size by watching the map
coordinates update
• Enter a lat/lon coordinate
Header file
 ENVI header file
• A small ascii text file that contains the basic
information that ENVI must know in order to read
the image data
• Extension
 Generation of header file
• Importing file
• Reading a generic format
• Reading a native format (e.g. GeoTiff)
No change  save in memory
Change  save in disk
 View and edit header file in ENVI
Exercise 2
 Generic import: defining an ENVI header
• Open image file: envidata/boulder/bldr_tm.dat
 Input: 702 samples, 863 lines, 6 bands, 0 bytes offset, floating point data type,
Host byte order, ENVI standard file type, BIP interleave, Band name = Band 1,
2, 3, 4, 5, 7
 Check cursor location/value  not georeferenced
• Add map information
 Reference pixel: (526, 645)  (480168.67E, 4427572.69N)
 Projection: UTM, zone 13, North American 1927
 Pixel size = 30m x 30m
 Wavelength: import ascii file  twave6.asc (two columns)
 Managing files
• Open image files: envidata/cup95av/cup95at.int
• Wavelength locator
• Available file list
Self test
 Repeat exercise 2
• Open image file: envidata/boulder/bldr_tm.dat
Input: 702 samples, 863 lines, 6 bands, 0 bytes offset,
floating point data type, Host byte order, ENVI standard
file type, BIP interleave, Band name = Band 1, 2, 3, 4, 5, 7
Check cursor location/value  not georeferenced
• Add map information
Reference pixel: (526, 645)  (480168.67E, 4427572.69N)
Projection: UTM, zone 13, North American 1927
Pixel size = 30m x 30m
Wavelength: import ascii file  twave6.asc (two columns)
Map information
 Why and what is mapping
• USGS map projections
 Two named structure
• ENVI_PROJ_STRUCT
 Define a map projection
• ENVI_MAP_STRUCT
 Define the georeferencing for an ENVI file
 Viewing current structure of projection
• proj = ENVI_PROJ_CREATE()
• help, proj, /structures
 Name: any name except for UTM- or utm- files
 Projection type: 38 types (see User guide, appendix D)
 Projection params: (see User guide, appendix D)
 Projection units: (e.g. deg = 6, feet = 2, meters = 0)
 Projection datum: (see C:\RSI\IDL60\products\envi40\map_proj)
Map information (cont.)
 Viewing current structure of map
• map_proj = ENVI_MAP_INFO_CREATE()
• help, map_proj , /struct
 proj: the ENVI_PROJ_STRUCT variable
 mc: a 4-element double array, [position in the image in file coordinates,
corresponding map coordinates]
 ps: a 2-element double array, the pixel size in the sample and line directions
 rotation
 pseudo: a flag used to indicate that the image has not been projected
 ENVI files related to map projections
• map_proj.txt: required parameters up to 15 values
• ellipse.txt: ellipse name, semi-major a, semi-minor b
• datum.txt:datum name, ellipse name, delta X, delta Y, delta Z
Exercise 3
 Getting map information
• ENVI_OPEN_FILE,
'C:\RSI\envidata\enviprog\avhrr\fl_avhrr.img‘
• map_infor = ENVI_GET_MAP_INFO(fid=fl_fid)
• help, map_infor, /struct
• help, map_infor.proj, /struct
• print,
ENVI_TRANSLATE_PROJECTION_NAME(map_infor.proj.
type)
• Ref to User’s guide, appendix D
• print, map_infor.proj.params[2:3]
• print, 'pixel sizes = ', map_infor.ps
• print, 'Units = ',
ENVI_TRANSLATE_PROJECTION_UNITS(map_infor.proj.
units)
Exercise 4
 Converting coordinates between map projections
•
•
•
•
•
•
•
•
•
lat_lon = dblarr(2,50)
fname = ENVI_PICKFILE(filter='*.txt')
OpenR, unit, fname, /Get_LUN
ReadF, unit, lat_lon
Free_LUN, unit
print, lat_lon[*, 0:4]
geo_proj = ENVI_PROJ_CREATE(/geographic)
sanfran_params = dblarr(6)
sanfran_params[0:5] = [a, b, lat0, lon0, x0, y0]
 The North America 1983 datum (see map_proj.txt)
 Projection origin: 37 North Latithde and 122 West Longitude
 False easting and northing will both be 500,000 meters
Exercise 4 (cont.)
 Converting coordinates between map projections
• print,
ENVI_TRANSLATE_PROJECTION_NAME('Polyconic')
• sanfran_proj = ENVI_PROJ_CREATE(type=10,
params=sanfran_params, name='WCoast Polyconic',
datum='North America 1983')
• help, /struct, geo_proj
• help, /struct, sanfran_proj
• ENVI_CONVERT_PROJECTION_COORDINATES,
lat_lon[1,*], lat_lon[0,*], geo_proj, mapX, mapY, sanfran_proj
• for i=0,49 do print, lat_lon[*,i], mapX[i], mapY[i],
format='(4(F20.5))‘
• ENVI_ADD_PROJECTION, sanfran_proj, /write
• Check the file: map_proj.txt
Map information (cont.)
 TWD 67
Map information (cont.)
 TWD 97
Exercise 5
 Write an IDL program to convert
coordinates between TWD67 and
TWD97 map projections
• Check file:
C:\RSI\IDL60\products\envi40\map_proj\map
_proj.txt
• Specify the required parameters for
TWD67: 6378160.0, 6356774.5, 0.000000, 121.000000,
250000.0, 0.0, 0.999900, Hu-Tzu-Shan, TWD67
TWD97: 6378137.0, 6356752.3, 0.000000, 121.000000,
250000.0, 0.0, 0.999900, WGS-84, TWD97
Vector data
 Vector data
• Utilize a coordinate-based system to represent
and locate physical elements such as points,
lines, and areas
• Vertices, arcs, polygons
• Compact
• Format supported by ENVI
• Available vectors list
• Vector parameters window
Exercise 6
 Vector layer overlay and editing
•
•
•
•
File: envidata/vectors/washdc_x.bil
Display: 321 RGB
Georeference image data
Open vector file: cities.shp, roads.shp, counties.shp
 Geographic Lat/Lon projection with WGS-84 datum
 It doesn’t specify a projection into which the imported vector data will be
converted!
• Display vector
• Editing vector displays
 Edit layer properties: Associate attribute name
• Display vector attributes
 Vector parameter, option, vector information, scroll, select one to display
 Vector parameter, edit, view/edit/query
 Change column width
 Sorting
 Change highlight color
Exercise 6 (cont.)
 Vector layer overlay and editing (cont.)
• Editing vector layers
 Select road.shp
 Model, edit existing vectors
 Tool, pixel locator, (690, 860)
 Add node
 Accept change
 Model, add new vector
 Node handles on
 Accept new polyline
• Add attribute information
 Vector parameter, edit, view/edit/query
 Querying vector attributes
• Vector parameters, Edit, query attributes, STATE_NAME == Virginia
 Vector to raster conversion
• Export active layer to ROIs
• Overlay
• Options, report area of ROIs, Miles2
Exercise 7
 Generating image contour lines and
overlaying vector layers
•
•
•
•
Read USGS DEM file
Mosaic and display
Contouring a DEM image
Overlay vectors on a 3-Dsurface view
Self test
 Repeat exercise 6 to generate the figure