GridStyle

Description

A GridStyle element defines a style for a MapInfo grid image.

Context

Table 1 lists the elements that can contain, or be contained by, a GridStyle element.

Table 1. Context
Contained by Element Contains

NamedStyle or CompositeStyle

GridStyle

Zero or one of each of the following:

Attributes

Table 2 lists the attributes of a GridStyle element.

Table 2. Attributes
Attribute Description

id

A unique identifier for the element.

name

A descriptive name for the element.

contrast

A floating-point value from 0 to 1 specifying the contrast of the image.

A value of 0 means that the image has minimum contrast. A value of 1 means that the image has maximum contrast. A value of 0.5 means that the image has 50% contrast.

The contrast attribute is optional. The default value is 0.5.

brightness

A floating-point value from 0 to 1 specifying the brightness of the image.

Brightness is a measure of the lightness or darkness of the image. A value of 0 means that the image has minimum brightness. A value of 1 means that the image has maximum brightness. A value of 0.5 means that the image has 50% brightness.

The brightness attribute is optional. The default value is 0.5.

opacity

A floating-point value from 0 to 1 specifying the opacity of the image.

A value of 0 means that the image is totally transparent. A value of 1 means that the image is totally opaque. A value of 0.5 means that the image is 50% translucent.

The opacity attribute is optional. The default value is 1.

grayscale

A boolean value (true or false) specifying whether the image should be displayed using only shades of gray, ranging from white to black.

The grayscale attribute is optional. The default value is false.

show-hillshade

A boolean value (true or false) specifying whether to display the grid image with relief shading in order to provide a more 3D appearance.

The show-hillshade attribute is optional. The default value is false.

null-color

A string value specifying the color used to indicate that a value is null.

The value can be any valid CSS color. (See http://www.w3.org/TR/REC-CSS1#color-units.)

The null-color attribute is optional. The default value is black.

Note: This attribute has no effect if null-transparent is true.

null-transparent

A boolean value (true or false) specifying whether null values should be displayed as transparent (true) or displayed as the color specified in null-color (false).

The null-transparent attribute is optional. The default value is false.

Examples

Example 1: This example specifies a grid image style that contains a RenderStyle of type LUTColor, a Custom DataTransform having a collection of six color breaks, and a collection of three grid inflection points.

<?xml version="1.0" encoding="UTF-8"?>
<NamedStyle
    version="MXP_WorkSpace_1_5"
    xmlns="http://www.mapinfo.com/mxp">
    <GridStyle
        id="migridstyle"
        name="migridstyle"
        contrast="0.5"
        brightness="0.5"
        opacity="1"
        grayscale="false"
        show-hillshade="false"
        null-color="black"
        null-transparent="true">
 	<RenderStyle type="LUTColor" underviewInterpolation="None">
		<Component type="color" field="0" band="1" dataTransform="MapInfoDataTransform">		
			<ColorTable>Pseudocolor.lut</ColorTable>							
		</Component>
		<Hillshade>			
			<SunShadow enable="True"/>				
			<Highlight enable="True"/>					
		</Hillshade>
	</RenderStyle>
	<DataTransformList>
		<DataTransform type="Custom" name="MapInfoDataTransform">							
			<ColorBreaksList>
				<ColorBreak value="-182.586959838867" color="#0000ff" />
				<ColorBreak value="57420.302986145" color="#1919ff" />
				<ColorBreak value="115023.192932129" color="#5e5eff" />
				<ColorBreak value="172626.082878113" color="#eeeeff" />
				<ColorBreak value="230228.972824097" color="#7f7f7f" />
				<ColorBreak value="287831.862770081" color="#a5a5a5" />					
			</ColorBreaksList>			
		</DataTransform>
	</DataTransformList>
	<GridInflectionList>
            <GridInflection
                value="0.4"
                color="yellow"/>
            <GridInflection
                value="0.5"
                color="green"/>
            <GridInflection
                value="0.6"
                color="blue"/>
        </GridInflectionList>
    </GridStyle>
</NamedStyle>

Example 2: Refer to the Raster Info MapInfo Pro for more information on field and band indexes. Spectrum Spatial uses 0-based indexes while the MapInfo Pro uses 1-based indexes.

Scenario 1: When the classified/palette (at field index 1) has a band of BandDataType RGB (at band index 3), use the following style to render raster correctly.

<?xml version="1.0" encoding="UTF-8"?>
<NamedStyle version="MXP_NamedResource_1_5" xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml">
      <GridStyle>
            <RenderStyle type="image" underviewInterpolation="Nearest">
                  <Component type="image" field="1" band="3"/>    
            </RenderStyle>
      </GridStyle>
</NamedStyle>

Scenario 2: When the classified/palette (at field index 1) doesn’t have any band of BandDataType RGB, but have a band of BandDataType Red (at band index 3), band of BandDataType Green (at band index 4), and band of BandDataType Blue (at band index 5) separately, use the following style to render raster correctly.

<?xml version="1.0" encoding="UTF-8"?>
<NamedStyle version="MXP_NamedResource_1_5" xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml">
        <GridStyle>
                <RenderStyle type="RGB" underviewInterpolation="Nearest">
                        <Component type="red" field="1" band="3"/>      
                        <Component type="green" field="1" band="4"/>
                        <Component type="blue" field="1" band="5"/>     
                </RenderStyle>
        </GridStyle>
</NamedStyle>