| 298 | a) Create an example VRT with gdal_translate. |
| 299 | |
| 300 | gdal_translate -of VRT east.dem east.vrt |
| 301 | |
| 302 | Inspect east.vrt, for instance with notepad. |
| 303 | |
| 304 | b) Skim VRT tutorial, available in Related Pages at www.gdal.org. |
| 305 | |
| 306 | Compare the elements of the tutorial to the elements of the file. |
| 307 | |
| 308 | c) Create VRT from geoworld.tif. |
| 309 | |
| 310 | gdal_translate -of VRT geoworld.tif 0to360.vrt |
| 311 | |
| 312 | d) Edit the <GeoTransform> tag and change: |
| 313 | |
| 314 | -1.800000e+02 |
| 315 | |
| 316 | to |
| 317 | |
| 318 | 0.0 |
| 319 | |
| 320 | to set the origin to 0 longitude instead of -180 (the dateline). Then |
| 321 | check the .vrt file with gdalinfo and OpenEV. |
| 322 | |
| 323 | gdalinfo 0to360.vrt |
| 324 | openev 0to360.vrt |
| 325 | |
| 326 | Our extents are right, but the imagery is still wrong! |
| 327 | |
| 328 | e) Duplicate and modify this section: |
| 329 | |
| 330 | <SimpleSource> |
| 331 | <SourceFilename relativeToVRT="1">geoworld.tif</SourceFilename> |
| 332 | <SourceBand>1</SourceBand> |
| 333 | <SrcRect xOff="0" yOff="0" xSize="2048" ySize="1024"/> |
| 334 | <DstRect xOff="0" yOff="0" xSize="2048" ySize="1024"/> |
| 335 | </SimpleSource> |
| 336 | |
| 337 | to look like this: |
| 338 | |
| 339 | <SimpleSource> |
| 340 | <SourceFilename relativeToVRT="1">geoworld.tif</SourceFilename> |
| 341 | <SourceBand>1</SourceBand> |
| 342 | <SrcRect xOff="0" yOff="0" xSize="1024" ySize="1024"/> |
| 343 | <DstRect xOff="1024" yOff="0" xSize="1024" ySize="1024"/> |
| 344 | </SimpleSource> |
| 345 | <SimpleSource> |
| 346 | <SourceFilename relativeToVRT="1">geoworld.tif</SourceFilename> |
| 347 | <SourceBand>1</SourceBand> |
| 348 | <SrcRect xOff="1024" yOff="0" xSize="1024" ySize="1024"/> |
| 349 | <DstRect xOff="0" yOff="0" xSize="1024" ySize="1024"/> |
| 350 | </SimpleSource> |
| 351 | |
| 352 | Check the result with openev ... now the hemispheres are appropriately |
| 353 | swapped! |
| 354 | |
| 355 | f) Now lets create an overlapping wrap world going from -180 to 360. |
| 356 | |
| 357 | gdal_translate -of VRT geoworld.tif overlap.vrt |
| 358 | |
| 359 | Change rasterXSize from 2048 to 3072. |
| 360 | |
| 361 | Leave GeoTransform unchanged. |
| 362 | |
| 363 | Add this SimpleSource for the 180 to 360 portion. |
| 364 | |
| 365 | <SimpleSource> |
| 366 | <SourceFilename relativeToVRT="1">geoworld.tif</SourceFilename> |
| 367 | <SourceBand>1</SourceBand> |
| 368 | <SrcRect xOff="0" yOff="0" xSize="1024" ySize="1024"/> |
| 369 | <DstRect xOff="2048" yOff="0" xSize="1024" ySize="1024"/> |
| 370 | </SimpleSource> |
| 371 | |
| 372 | |
| 373 | Python Scripting |
| 374 | ---------------- |
| 375 | |
| 376 | Do a demonstration of reading east.dem into a Numeric array, |
| 377 | setting all pixel values less than 1 to -100, and saving to a new |
| 378 | file. |
| 379 | |