Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have some orthophoto files (Erdas Imagine format) enclosed in a vrt file. When I view it in any desktop GIS it has proper RGB colors, but when I use the vrt in Mapnik to render some tiles, I get grayscale images as a result. Why?

Update: If I convert the Erdas Imagine files into png-s (I need transparency where there is no data) Mapnik render works ok, so I guess it's something to do with how Mapnik interprets Erdas files and its bands.

share|improve this question
    
Try filing a bug report at github.com/mapnik/mapnik/issues –  user10824 Oct 9 '12 at 2:51
    
I think i ll dig a little further, because i dont think its a bug. –  U2ros Oct 9 '12 at 6:52
add comment

1 Answer

You might want to double-check that your VRT is specifying proper red/green/blue assignments for the bands. (And possibly alpha if you have a special alpha band.)

I had a somewhat similar problem where I'd made a VRT, and Mapnik didn't seem to render anything from it. When I looked at the VRT, all four bands looked like this:

<VRTRasterBand dataType="Byte" band="1" subClass="VRTWarpedRasterBand">
  <ColorInterp>Gray</ColorInterp>
</VRTRasterBand>
...
...

To fix it, I manually applied proper ColorInterp assignments. I actually opened my VRT in QGIS to see how it was applying the RGB assignments. Sure enough, 1 2 and 3 corresponded directly to R G and B. So I suspect the other software must use this assumption when band assignments aren't stated?

<VRTRasterBand dataType="Byte" band="1" subClass="VRTWarpedRasterBand">
  <ColorInterp>Red</ColorInterp>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="2" subClass="VRTWarpedRasterBand">
  <ColorInterp>Green</ColorInterp>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="3" subClass="VRTWarpedRasterBand">
  <ColorInterp>Blue</ColorInterp>
</VRTRasterBand>
<VRTRasterBand dataType="Byte" band="4" subClass="VRTWarpedRasterBand">
  <ColorInterp>Alpha</ColorInterp>
</VRTRasterBand>

Unfortunately, I don't remember exactly how I created my VRT, which resulted in all four bands being assigned to Gray (or maybe it was Unknown, there's a complete list of values here).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.