Export GeoTiff and preserve the Pal Idx
RobertR
GlobalMapper Fan!Trusted User
Hello,
I used a script to crop a raster file into pieces, but the output does not contain the initial format, the pal idx code.
Before:
After:
The idea was to crop the raster image to smaller ones in order to generate area features from equal values for a few pal idx codes (I tried it on the entire file but it crashed). I must have done something wrong as the create areas process takes way too much.
I used EXPORT_RASTER FILENAME="C:\Downloads\Export\.tif" TYPE="GEOTIFF" /
GEN_PRJ_FILE="YES" COMPRESSION="LZW" POLYGON_CROP_FILE="%USASTATES%" /
POLYGON_CROP_USE_EACH="YES" POLYGON_CROP_NAME_ATTR="NAME"
The exported files now have only the RGB color. Is it possible to somehow add the pal idx back? I would really need it in the vector attribute table. Is it even possible to have the pal idx code in the attribute table?
Global Mapper creates the RGB column, gdal_polygonize.py some type of the pixel value of that polygon (but I did not recognize it to be RGB or PalIDx).
I used a script to crop a raster file into pieces, but the output does not contain the initial format, the pal idx code.
Before:
Band 1 Block=128x128 Type=Byte, ColorInterp=Palette
Min=0.000 Max=95.000
Minimum=0.000, Maximum=95.000, Mean=30.261, StdDev=32.473
NoData Value=255
Metadata:
RepresentationType=THEMATIC
STATISTICS_COVARIANCES=1054.51245173011
STATISTICS_MAXIMUM=95
STATISTICS_MEAN=30.260543032059
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=32.473257485662
Color Table (RGB with 256 entries)
0: 0,0,0,255
1: 0,250,0,255
2: 0,0,0,255
3: 0,0,0,255
4: 0,0,0,255
5: 0,0,0,255
6: 0,0,0,255
7: 0,0,0,255
8: 0,0,0,255
9: 0,0,0,255
10: 0,0,0,255
11: 71,107,161,255
12: 209,222,250,255
After:
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 122656.347, 1510471.824) ( 94d36'55.70"W, 36d37'56.89"N)
Lower Left ( 122656.347, 1107301.824) ( 94d40'43.46"W, 33d 1'41.78"N)
Upper Right ( 568156.347, 1510471.824) ( 89d35'45.55"W, 36d28'10.18"N)
Lower Right ( 568156.347, 1107301.824) ( 89d53'16.22"W, 32d52'19.67"N)
Center ( 345406.347, 1308886.824) ( 92d11'38.56"W, 34d46'40.94"N)
Band 1 Block=14850x32 Type=Byte, ColorInterp=Red
Band 2 Block=14850x32 Type=Byte, ColorInterp=Green
Band 3 Block=14850x32 Type=Byte, ColorInterp=Blue
The idea was to crop the raster image to smaller ones in order to generate area features from equal values for a few pal idx codes (I tried it on the entire file but it crashed). I must have done something wrong as the create areas process takes way too much.
I used EXPORT_RASTER FILENAME="C:\Downloads\Export\.tif" TYPE="GEOTIFF" /
GEN_PRJ_FILE="YES" COMPRESSION="LZW" POLYGON_CROP_FILE="%USASTATES%" /
POLYGON_CROP_USE_EACH="YES" POLYGON_CROP_NAME_ATTR="NAME"
The exported files now have only the RGB color. Is it possible to somehow add the pal idx back? I would really need it in the vector attribute table. Is it even possible to have the pal idx code in the attribute table?
Global Mapper creates the RGB column, gdal_polygonize.py some type of the pixel value of that polygon (but I did not recognize it to be RGB or PalIDx).
Comments
-
I will answer my own question..
I added the PALETTE="KEEP_SOURCE" BG_TRANSPARENT=YES params and I guess it will do the job. Then, using gdal_polygonize.py I get exactly what I need in my vector attribute column.
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website