Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color interpolation sometimes fails #111

Closed
moradology opened this issue May 14, 2019 · 1 comment · Fixed by #209
Closed

Color interpolation sometimes fails #111

moradology opened this issue May 14, 2019 · 1 comment · Fixed by #209
Assignees
Labels

Comments

@moradology
Copy link
Collaborator

stack trace:

java.lang.IllegalArgumentException: step cannot be 0.
        at scala.collection.immutable.NumericRange$.count(NumericRange.scala:279)
        at scala.collection.immutable.NumericRange.numRangeElements$lzycompute(NumericRange.scala:52)
        at scala.collection.immutable.NumericRange.numRangeElements(NumericRange.scala:51)
        at scala.collection.immutable.NumericRange.length(NumericRange.scala:54)
        at scala.collection.immutable.NumericRange.foreach(NumericRange.scala:72)
        at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59)
        at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:183)
        at geotrellis.server.ogc.Render$.linearInterpolationBreaks(Render.scala:40)
        at geotrellis.server.ogc.ColorRampStyle.renderImage(OgcStyle.scala:64)
        at geotrellis.server.ogc.Render$.apply(Render.scala:16)
        at geotrellis.server.ogc.wms.WmsView$$anonfun$responseFor$1$$anonfun$apply$5.apply(WmsView.scala:91)
        at geotrellis.server.ogc.wms.WmsView$$anonfun$responseFor$1$$anonfun$apply$5.apply(WmsView.scala:89)
        at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:139)
        at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:351)
        at cats.effect.internals.IORunLoop$RestartCallback.run(IORunLoop.scala:362)
        at cats.effect.internals.Trampoline.cats$effect$internals$Trampoline$$immediateLoop(Trampoline.scala:70)
        at cats.effect.internals.Trampoline.startLoop(Trampoline.scala:36)
        at 

with conf:

	styles = [
            {
                name = "greyscale2"
                title = "Greyscale Ramp"
                type = "colorrampconf"
                colors = ${color-ramps.slope}
                min-render = 0
                max-render = 80
                stops = 255
            }
        ]
		
	"slope": [
        0x000000FF, 0xFFFFFFFF
    ] 
@moradology moradology self-assigned this May 14, 2019
@moradology moradology added the bug label May 14, 2019
@jfbourgon
Copy link

The issue might be related to computed values from the layer since a similar configuration on another layer is not raising the exception:

slope = {
        type = "mapalgebrasourceconf"
        name = "slope"
        title = "Slope Map of High Resolution Digital Terrain Model generated from LiDAR"
        algebra = {
          "args" : [
            {
              "name" : "hrdtm",
              "symbol" : "rasterV"
            }
          ],
          "symbol" : "fslope"
        }
        defaultStyle = "default"
        styles = [
            {
                name = "greyscaleramp"
                title = "Greyscale Ramp"
                type = "colorrampconf"
                colors = ${color-ramps.slope}
                min-render = 0
                max-render = 90
                stops = 255
            },
            {
                name = "greyscalemap"
                title = "Greyscale Map"
                type = "colormapconf"
                color-map = ${color-maps.slope}
            }
        ]
    },
    hillshade = {
        type = "mapalgebrasourceconf"
        name = "hillshade"
        title = "Hillshade of High Resolution Digital Terrain Model generated from LiDAR"
        algebra = {
          "args" : [
            {
              "name" : "hrdtm",
              "symbol" : "rasterV"
            }
          ],
          "azimuth": 315,
          "altitude": 60,
          "symbol" : "fhillshade"
        }
        defaultStyle = "default"
        styles = [
            {
                name = "greyscaleramp"
                title = "Greyscale Ramp"
                type = "colorrampconf"
                colors = ${color-ramps.slope}
                min-render = 0
                max-render = 127
                stops = 255
            },
            {
                name = "greyscalemap"
                title = "Greyscale Map"
                type = "colormapconf"
                color-map = ${color-maps.hillshade}
            }
        ]
    }
}

color-ramps = {
    "red-to-blue": [
        0x2A2E7FFF, 0x3D5AA9FF, 0x4698D3FF, 0x39C6F0FF,
        0x76C9B3FF, 0xA8D050FF, 0xF6EB14FF, 0xFCB017FF,
        0xF16022FF, 0xEE2C24FF, 0x7D1416FF
    ],
    "elevation": [
        0x375A91FF, 0x2D82B9FF, 0x78B978FF, 0x91C882FF, 0xB9DC91FF, 0xFFFFAAFF, 0xE6DC8CFF, 0xCDBE73FF, 0xB49B55FF, 0x9B7D37FF, 0x6E3C00FF, 0xA59678FF, 0xD7D7D7FF, 0xFFFFFFFF
    ],
    "greyscale": [
        0x000000FF, 0xA6A6A6FF
    ],
    "slope": [
        0x000000FF, 0xFFFFFFFF
    ]    
}

color-maps = {
...

in this example, the hillshade layer will render with the greyscaleramp but not the slope layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants