3

I have this original image

enter image description here

But when i open it in TileMill, it converts image like this. White areas are transparent in the image

enter image description here

This is more like, it removes all no data values i.e. 255 in my original image. How can i set custom no data value with TileMill and also set RGB bands null value to null. I don't want RB

  • What kind of image is that? Which extension? How do you import it into TileMill? – Taras Feb 27 at 8:05
  • It's geotiff file with .tif extension. I am importing it using Add Layer from TileMill. – Ahsan Mukhtar Feb 27 at 9:33
  • Did you add band=1 as input in the Advanced input area? What happens if you type in CartoCSS the following command raster-colorizer-default-mode: exact? – Taras Feb 27 at 9:37
  • I have tried tha, but still the same results are generated. – Ahsan Mukhtar Feb 27 at 10:03
  • What happens if you open the same GeoTIFF in QGIS or ArcGIS etc.? Have you tried to play with VRT and to set up an XML for your GeoTIFF? – Taras Feb 27 at 10:11
2

There is no direct solution to this problem as per my knowledge. But there is a workaround that can be used to solve the problem with map.

Do these steps in ArcMap

1) Clip your raster by the boundary using image analysis window.

2) Export the raster in "tif" format with Nodata value = 0

Do these steps in TileMill

3) Open tilemill project. Add the clipping boundary and add this line in cartocss of boundary:

background-color: #000

4) overlay your raster 3 times individual bands. Add band = 1 in advanced setting then for 2nd time add band = 2, and then band = 3 and add this style:

#red {
  raster-scaling:gaussian;
  raster-comp-op:plus;
  raster-colorizer-default-mode:linear;
  raster-colorizer-default-color: transparent;
  raster-colorizer-epsilon:0.1;
  raster-colorizer-stops:
    stop(0,#000)
    stop(255,rgb(255,0,0))
}
#green {
  raster-scaling:gaussian;
  raster-comp-op:plus;
  raster-colorizer-default-mode:linear;
  raster-colorizer-default-color: transparent;
  raster-colorizer-epsilon:0.1;
  raster-colorizer-stops:
    stop(0,#000)
    stop(255,rgb(0,255,0))
}
#blue {
  raster-scaling:gaussian;
  raster-comp-op:plus;
  raster-colorizer-default-mode:linear;
  raster-colorizer-default-color: transparent;
  raster-colorizer-epsilon:0.1;
  raster-colorizer-stops:
    stop(0,#000)
    stop(255,rgb(0,0,255))
}

It will give you exact results you need.

  • thanks! It worked for me. You are super genius. – Ahsan Mukhtar Mar 11 at 7:24
  • Absolutely agree with you, @gis-professional. – Taras Mar 11 at 7:37

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.