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.

  • 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

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">

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">
<VRTRasterBand dataType="Byte" band="2" subClass="VRTWarpedRasterBand">
<VRTRasterBand dataType="Byte" band="3" subClass="VRTWarpedRasterBand">
<VRTRasterBand dataType="Byte" band="4" subClass="VRTWarpedRasterBand">

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).

Your Answer

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

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