0
$\begingroup$

I imported land cover classes from a GeoTiff file created in QGIS, where the classes are coded by discrete values (NLCD nomenclature). But it seemed the import function mirrors the values (maybe a bug), can I solve it someway?

First have a look at the image:

output = Import[
  "d:\\bitbucket\\diversity\\data\\nlcd_200x200.tif", {"GeoTIFF", 
   "Image"}] 

Import as data:

output = Import[
  "d:\\bitbucket\\diversity\\data\\nlcd_200x200.tif", {"GeoTIFF", 
   "Data"}] 

Try to represent with color codes, you will see the mirror of the image:

ArrayPlot[output, 
 ColorRules -> {11 -> RGBColor[102, 140, 191], 
   12 -> RGBColor[255, 255, 255], 21 -> RGBColor[252, 227, 227], 
   22 ->  RGBColor[247, 171, 158], 23 -> RGBColor[230, 87, 77], 
   31 -> RGBColor[209, 204, 191], 32 -> RGBColor[176, 176, 176], 
   33 -> RGBColor[81, 60, 117], 41 -> RGBColor[135, 199, 128] , 
   42 -> RGBColor[56, 130, 79] , 43 -> RGBColor[211, 232, 176] , 
   51 -> RGBColor[219, 201, 117] , 61 -> RGBColor[186, 173, 117] , 
   71 -> RGBColor[252, 232, 171] , 81 -> RGBColor[252, 247, 94], 
   82 -> RGBColor[201, 145, 71], 83 -> RGBColor[121, 107, 73], 
   84 -> RGBColor[245, 237, 204], 85 -> RGBColor[240, 156, 54], 
   91 -> RGBColor[201, 230, 250], 92 -> RGBColor[145, 191, 217] }]

Download testfile here.

$\endgroup$
  • $\begingroup$ Different functions/formats use different orientation conventions. Use DataReversed -> True as option to ArrayPlot. $\endgroup$ – jose Dec 21 '17 at 3:03
  • $\begingroup$ You can also try ReliefPlot[output]. $\endgroup$ – jose Dec 21 '17 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.