340 likes | 571 Views
Reprojecting Raster Data of Global Extent. Auto-Carto 2005: A Research Symposium 21 - 23 March, 2005 Las Vegas, Nevada. E. Lynn Usery usery@usgs.gov. Reprojecting Raster Data of Global Extent. Daniel R. Steinwand,
E N D
Reprojecting Raster Data of Global Extent Auto-Carto 2005: A Research Symposium 21 - 23 March, 2005 Las Vegas, Nevada E. Lynn Usery usery@usgs.gov
Reprojecting Raster Data of Global Extent • Daniel R. Steinwand, • Science Applications International Corp., USGS National Center for Earth Resources Observation and Science (EROS), Sioux Falls, SD • Michael P. Finn, Jason R. Trent, E. Lynn Usery, and Robert A. Buehler, • USGS, Mid-Continent Mapping Center, Rolla, MO
Outline • Objectives • Approach • Methods • Coordinate Transformations • Framing (Output Frame) • Forward vs. Inverse Mapping (Reprojection) • Wraparound • Resampling • Implementing a map image projection program • Conclusions
Objectives • Solve problems associated with projection of global raster datasets and corresponding errors to global environmental models • Provide a software package that better handles known problems (including raster categorical resampling) for wide use in the modeling community
Approach • Expand on previous research • Handle identified issues and problems • Chain various geospatial, computational, and map projection methods into a solution framework • Implement a software package to handle the reprojection of global raster datasets
Methods • Coordinate Transformations • Framing • Output Frame (Geographic MinBox and Direct Specification) • Forward vs. Inverse Mapping • Reprojection (Algorithm) • Wraparound • Resampling • Categorical Resampling
Coordinate Transformations • Subroutine packages usually operate on a point-by-point basis • General Cartographic Transformation Package (GCTP) • Point-by-point basis • C programming language • Works for both vector and raster data • Datum transformations usually included
Framing • Extent of the image (raster data) in projection space • Where and how that space is aligned with the image coordinate system • First-order transformation (translation and scaling) • Tie two coordinate systems together • UL image pixel to center of UL pixel in projection space • Equations (image to/ from projection coordinates) • Determine Output Image Frame
Framing EquationsImage to/ from projection coordinates • X = ULprojX + (sample – 1) * pixelSizeX • Y = ULprojY – (line – 1) * pixelSizeY • Line = (ULprojY – Y)/pixelSizeY + 1 • Sample = (X – ULprojX)/PixelSizeX + 1 (Upper Left image pixel is pixel (1,1), i.e., 1-relative coordinates)
Determine Output Image Frame • The geographic extent of the (re)projection output image • In units of the output image projection system • Common Methods • The geographic MinBox • Direct specification of output projection extent
Determine Output Image Frame The Geographic MinBox • User defines output image extent with UpperLeft and LowerRight geographic coordinates
Determine Output Image Frame The Geographic MinBox • The frame is conceptualized in geographic space (with grid lines added for clarification)
Determine Output Image Frame The Geographic MinBox • This space is converted to the output projection. • Corners & Sides of the frame are converted (piecewise) and projection coordinate minimums and maximums are recorded.
Determine Output Image Frame The Geographic MinBox • Locations of the min/max projection coordinates are noted.
Determine Output Image Frame The Geographic MinBox • The minimum and maximum extents form the MinBox—this is the extent of the output image. • The number of lines and samples are determined by dividing these dimensions by the pixel size.
Determine Output Image Frame The Geographic MinBox • If the MinBox algorithm is not applied, and only the UL and LR geographic coordinates are used to determine projection min/max, clipping of the frame can occur.
Determine Output Image Frame Direct specification of projection extent • User specifies the min and max coordinates of the output space • Or, alternatively: Specify the UL corner of the image and the number of lines and samples
Forward vs. Inverse Mapping • Inverse mapping algorithm • Steps through the output image space and calculates the corresponding coordinates in the input image; then selects the pixel value (and perhaps neighboring values) at those input coordinates
Inverse Mapping AlgorithmPseudo CodeSimplest case: point-by-point, nearest neighbor • For each line in the output image: • For each pixel in this output image line: • Determine the output space projection coordinate for this pixel • Convert the coordinate to the input space projection • Determine the input space image coordinate • Grab the image value(s) at the input image coordinate
Resampling • Geospatial data of global extent can suffer from great geometric distortions when being reprojected • Errors associate with these distortions and scale changes affect resampling within the reprojection function, especially for categorical data
ResamplingNearest Neighbor • 1 point in the output space image and map that point into the input image space (via the inverse mapping algorithm)
ResamplingNearest Neighbor • If the resolution of the output imagery is reduced (downsampling), adjacent pixels in the output may fall more the 1 pixel away in the input (via the inverse mapping algorithm)
Categorical Resampling • New resampling algorithm treats pixels as areas (not points, Steinwand (2003)) • 4 corners of each pixel are mapped into the input space • Many pixels involved • Can apply simple statistical methods to determine output image pixels based on the area the pixel coverage in the input image
MapImg: An ImplementationTypical Output Solves wraparound problem Extreme Downsampling and Reprojection with the Nearest Neighbor
MapImg: Output Can provide better categorical resampling in extreme downsampling
MapImgStand-Alone Program • Multiplatform • MS Windows • UNIX (many variants) • Linux • User interface (startup screen)
MapImgProgram controls • Via dialog boxes • Data type • User’s projection choices • All parameter entries • Provides user’s with • Reprojected image • A metadata file • Summary window • Optional log file
MapImgC and C++ • GCTP at the core • Software design =>
MapImgTechniques, I/O, Data Structures, Algorithms • Utilizes multiple techniques for input, storage, and output of various data files (primarily generic binary raster images) • 3 primary data structures • IMGINFO structure • The projinfo class • The GUI • 2 major algorithms within mapimg.exe • mapframeit() • mapimg()
mapimg.exe • mapframeit algorithm • Calculates the row and column dimension • Caluclates the UL corner for a given projection • mapimg algorithm • Loops through every row and column in the output raster and loads the appropriate value • Checks for fill values and wraparound • Controls I/O buffering for time optimization
Conclusions • Projection of global raster data is a significant problem • Categorical resampling with modal categories yields better results than nearest neighbor methods • MapImg program provides solutions to raster data reprojection for a variety of computer architectures and is freely available
Reprojecting Raster Data of Global Extent Auto-Carto 2005: A Research Symposium 21 - 23 March, 2005 Las Vegas, Nevada http://carto-research.er.usgs.gov/projection/index.html