mapbox / mapbox-studio-classic

https://www.mapbox.com/mapbox-studio/
BSD 3-Clause "New" or "Revised" License
1.14k stars 229 forks source link

raster-colorizer-* styles not working #1540

Open four43 opened 8 years ago

four43 commented 8 years ago

I have a grayscale raster image that I am using in a source project in Mapbox Studio Classic (v0.3.3). I am looking to colorize it based on color ramps. The raster-colorizer methods seemed to fit the need but I'm having trouble: They aren't doing anything.

Source GeoTiff gdalinfo:

Driver: GTiff/GeoTIFF
Files: mercator-test.tif
Size is 4042, 4968
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["unnamed ellipse",
        DATUM["unknown",
            SPHEROID["unnamed",6378137,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-10686671.119999999180436,6891041.719999999739230)
Pixel Size = (881.302253834734984,-881.545187198067651)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-10686671.120, 6891041.720) ( 96d 0' 0.00"W, 52d30' 0.00"N)
Lower Left  (-10686671.120, 2511525.230) ( 96d 0' 0.00"W, 22d 0' 0.00"N)
Upper Right (-7124447.410, 6891041.720) ( 64d 0' 0.00"W, 52d30' 0.00"N)
Lower Right (-7124447.410, 2511525.230) ( 64d 0' 0.00"W, 22d 0' 0.00"N)
Center      (-8905559.265, 4701283.475) ( 80d 0' 0.00"W, 38d51'27.08"N)
Band 1 Block=4042x2 Type=Byte, ColorInterp=Gray

The image projects properly and is visible in the source project just fine.

I then created a style from this source project:

Map {
  background-color: transparent;
}

#_image {
  raster-opacity:1;
  raster-scaling:near;
  raster-colorizer-default-mode: linear;
  raster-colorizer-epsilon: 0.41;
  raster-colorizer-default-color: #0F0;
  raster-colorizer-stops: 
      stop(0, #FF0000) 
      stop(255, #0000FF);
  raster-comp-op: dst-over; 
}

The image once again is displaying fine, just no colors have been applied to it. I can see the grayscale image, change the opacity and the raster opacity changes. I just cannot see the colorizer results.

I can upload some test files if needed, I would just like a quick sanity check to make sure I'm not doing anything obviously wrong.

EDIT: I was using this old TileMill doc as a reference: https://www.mapbox.com/blog/tilemill-raster-colorizer/ and am looking to achieve a simliar effect. The UI in mapbox-studio-classic is obviously a bit different but I was hoping a similar effect would be possible.

four43 commented 8 years ago

I just found some additional info. That same setup works in Mapbox Studio Classic v0.2.7. When I was using Mapbox Studio Classic v0.3.3 the same project didn't work. Bummer. Those apps use node-mapnik v3.1.2 vs v3.4.9. Thinking it might be a mapnik bug then... I'll create an issue over there and reference this one.