Updated RasterColorizer (markdown)

tmcw 2011-12-09 12:01:32 -08:00
parent a4d1973be8
commit fac1c58340

@ -81,10 +81,11 @@ In this example XML, the following value to color translation is performed:
* 18 <= x < 100 green blending to indigo * 18 <= x < 100 green blending to indigo
#!xml ```xml
<?xml version="1.0" encoding="utf-8"?> #!xml
<Map srs="+proj=latlong +datum=WGS84"> <?xml version="1.0" encoding="utf-8"?>
<Style name="elevation"> <Map srs="+proj=latlong +datum=WGS84">
<Style name="elevation">
<Rule> <Rule>
<RasterSymbolizer> <RasterSymbolizer>
<RasterColorizer default-mode="linear" default-color="white" epsilon="0.001"> <RasterColorizer default-mode="linear" default-color="white" epsilon="0.001">
@ -99,18 +100,18 @@ In this example XML, the following value to color translation is performed:
</RasterColorizer> </RasterColorizer>
</RasterSymbolizer> </RasterSymbolizer>
</Rule> </Rule>
</Style> </Style>
<Layer name="dataraster"> <Layer name="dataraster">
<StyleName>elevation</StyleName> <StyleName>elevation</StyleName>
<Datasource> <Datasource>
<Parameter name="file">../mapnik2/tests/data/raster/dataraster.tif</Parameter> <Parameter name="file">../mapnik2/tests/data/raster/dataraster.tif</Parameter>
<Parameter name="type">gdal</Parameter> <Parameter name="type">gdal</Parameter>
<Parameter name="band">1</Parameter> <Parameter name="band">1</Parameter>
</Datasource> </Datasource>
</Layer> </Layer>
</Map>
</Map> ```
# Python Bindings # Python Bindings
@ -140,13 +141,15 @@ This is the enumeration of the stop modes. The values are _mapnik2.COLORIZER_LIN
## Example Python ## Example Python
#!py ```python
import mapnik2 #!py
c = mapnik2.RasterColorizer( mapnik2.COLORIZER_DISCRETE , mapnik2.Color(0,0,0,255) ) import mapnik2
c.epsilon = 0.001 c = mapnik2.RasterColorizer( mapnik2.COLORIZER_DISCRETE , mapnik2.Color(0,0,0,255) )
c.add_stop(-10) c.epsilon = 0.001
c.add_stop(15.83, mapnik2.COLORIZER_EXACT) c.add_stop(-10)
c.add_stop(20, mapnik2.Color("red")) c.add_stop(15.83, mapnik2.COLORIZER_EXACT)
c.add_stop(30.25, mapnik2.COLORIZER_LINEAR, mapnik2.Color("green")) c.add_stop(20, mapnik2.Color("red"))
c.get_color(23.124) c.add_stop(30.25, mapnik2.COLORIZER_LINEAR, mapnik2.Color("green"))
c.stops[1].color c.get_color(23.124)
c.stops[1].color
```