#5172 closed enhancement (fixed)
[PATCH] Add CreateCopy() support for the Farsite LCP driver.
Reported by: | Kyle Shannon | Owned by: | Kyle Shannon |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.0 |
Component: | GDAL_Raster | Version: | svn-trunk |
Severity: | normal | Keywords: | lcpdataset |
Cc: | Even Rouault |
Description
It would be nice to have a method to create lcp datasets using gdal. All units/metadata should be configurable using creation options, with reasonable defaults. I will prepare a patch and apply after some testing.
Attachments (1)
Change History (9)
comment:1 by , 11 years ago
Milestone: | 1.10.1 → 2.0 |
---|
comment:3 by , 11 years ago
Cc: | added |
---|---|
Summary: | Add CreateCopy() support for the Farsite LCP driver. → [PATCH] Add CreateCopy() support for the Farsite LCP driver. |
Even, I am sure it would be okay to apply this given the small user-base, but could you look over the patch including the byte swapping, it's my first shot at it. No rush whatsoever. Thanks.
follow-up: 5 comment:4 by , 11 years ago
Kyle,
just a few things I've caught :
1475 #ifdef CPL_MSB 1476 GDALSwapWords( panMetadata, 4, LCP_MAX_BANDS, 4 ); 1477 #endif 1478 VSIFWriteL( panMetadata, 2, LCP_MAX_BANDS, fp );
--> Should be GDALSwapWords( panMetadata, 2, LCP_MAX_BANDS, 2 ); I think
1482 const char *pszFilePath = 1483 CPLFormFilename( CPLGetPath( papszFileList[0] ), 1484 CPLGetBasename( papszFileList[0] ), 1485 CPLGetExtension( papszFileList[0] ) );
--> unless I've missed something, const char *pszFilePath = papszFileList[0] should be equivalent, no ?
1489 #ifdef CPL_MSB 1490 GDALSwapWords( pszFilePath, 1, CPLStrnlen( pszFilePath ), 1 ); 1491 #endif
--> useless. Byte swapping only makes sense for multi-byte datatypes.
1511 #ifdef CPL_MSB 1512 GDALSwapWords( pszDescription, 1, CPLStrlen( pszDescription ), 1 ); 1513 #endif
--> idem
1529 if( !pfnProgress( 0.0, NULL, pProgressData ) ) 1530 { 1531 VSIFCloseL( fp ); 1532 return NULL; 1533 }
--> lacks a VSIFree( panScanline );
1558 if( !pfnProgress( iLine / (double)nYSize, NULL, pProgressData ) ) 1559 { 1560 VSIFCloseL( fp ); 1561 return NULL; 1562 }
--> idem
It would be good if you could enhance autotest/gdrivers/lcp.py to test this new write capability.
Other than the above, just go ahead and apply your code.
comment:5 by , 11 years ago
Replying to rouault:
Kyle,
just a few things I've caught :
1475 #ifdef CPL_MSB 1476 GDALSwapWords( panMetadata, 4, LCP_MAX_BANDS, 4 ); 1477 #endif 1478 VSIFWriteL( panMetadata, 2, LCP_MAX_BANDS, fp );--> Should be GDALSwapWords( panMetadata, 2, LCP_MAX_BANDS, 2 ); I think
Yes. Corrected.
1482 const char *pszFilePath = 1483 CPLFormFilename( CPLGetPath( papszFileList[0] ), 1484 CPLGetBasename( papszFileList[0] ), 1485 CPLGetExtension( papszFileList[0] ) );--> unless I've missed something, const char *pszFilePath = papszFileList[0] should be equivalent, no ?
Yes, corrected.
1489 #ifdef CPL_MSB 1490 GDALSwapWords( pszFilePath, 1, CPLStrnlen( pszFilePath ), 1 ); 1491 #endif
--> useless. Byte swapping only makes sense for multi-byte datatypes.
Yes, Corrected. My mistake.
1511 #ifdef CPL_MSB 1512 GDALSwapWords( pszDescription, 1, CPLStrlen( pszDescription ), 1 ); 1513 #endif
--> idem
1529 if( !pfnProgress( 0.0, NULL, pProgressData ) ) 1530 { 1531 VSIFCloseL( fp ); 1532 return NULL; 1533 }
--> lacks a VSIFree( panScanline );
Yes, corrected.
1558 if( !pfnProgress( iLine / (double)nYSize, NULL, pProgressData ) ) 1559 { 1560 VSIFCloseL( fp ); 1561 return NULL; 1562 }
--> idem
It would be good if you could enhance autotest/gdrivers/lcp.py to test this new write capability.
I have about 10 new tests written. I will write some to handle creation options and proper copying.
Other than the above, just go ahead and apply your code.
Thanks for taking a look.
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:7 by , 11 years ago
Move check for linear unit into a different control statement so it is checked all the time (trunk r26396)
comment:8 by , 10 years ago
Milestone: | 2.0 → 1.11.0 |
---|
Push to 2.0/trunk and attach patch.