The theme
object is used to configure how the MapCraft themes (colors) an attribute on the map.
-
scaleType: string (required)
Determines how the data will be visualized on the map.
linear
: Linear scale (also known as equal-interval)quantile
: Quantile scalejenks
: Natural breakpoint scale (implementation here)manual
: User-defined breakscategorical
: Categories with defined color schemeboolean
: For boolean data
-
highlightColor: string (optional)
Defines the color used to highlight selected regions or areas (i.e. when you click on a shape).
Example:
"highlightColor": "#393B79"
-
opacity: number (optional)
Opacity level of filled-in shapes, ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
Example:
"opacity": 0.9
-
isFlipped: boolean (optional)
Indicates if the color scheme is inverted.
Example:
"isFlipped": true
-
scaleType:
"manual"
(required) -
colorScheme: string (required) (Details)
-
breaks: list[float] (required)
Specifies break points for color bands.
-
scaleType:
"boolean"
(required) -
colorScheme: str (required) (Details)
-
scaleType:
"linear"
or"jenks"
or"quantile"
(required) -
colorScheme: str (required) (Details)
-
numBins: int (required, an integer between 4 and 9)
Number of bins to be used in the graduated scale.
Example:
"numBins": 6
-
scaleType:
"categorical"
(required) -
categories: JSON (required)
Defines categories and corresponding colors for categorical layers.
Example:
{ "categories": [ { "category": "C1-40", "color": "#5254A3" }, { "category": "C2-55 (M)", "color": "#637939" } ] }
Detailed schema definition and example from MapCraft API documentation here.
- BrBG
- PiYG
- PRGn
- PuOr
- RdBu
- RdGy
- RdYlBu
- RdYlGn
- Spectral
- Blues
- Greens
- Greys
- Oranges
- Purples
- Reds
- BuGn
- BuPu
- GnBu
- OrRd
- PuBu
- PuBuGn
- PuRd
- RdPu
- YlGn
- YlGnBu
- YlOrBr
- YlOrRd
Color Brewer playground here.
Full colors details here.
A theme map is used to map attribute names to theme objects
{
"EffRent_Flex": {
"colorScheme": "PuRd",
"highlightColor": "#ffffcc",
"opacity": 0.9,
"scaleType": "linear"
},
"HighestRLV": {
"breaks": [
0,
500,
1000,
1500,
2000,
25000,
3000
],
"colorScheme": "PRGn",
"highlightColor": "#ffffcc",
"opacity": 0.9,
"scaleType": "manual"
},
"Owner_Area": {
"colorScheme": "Oranges",
"highlightColor": "#ffffcc",
"opacity": 0.9,
"scaleType": "linear"
},
"ZONING": {
"categories": [
{
"category": "C1-40",
"color": "#5254A3"
},
{
"category": "C1-65",
"color": "#6B6ECF"
},
{
"category": "C1-30",
"color": "#393B79"
},
{
"category": "C2-40",
"color": "#9C9EDE"
},
{
"category": "SM-D 40-85",
"color": "#9F0CB0"
}
],
"highlightColor": "#ffffcc",
"opacity": 0.9,
"scaleType": "categorical"
},
"zoned_capacity": {
"colorScheme": "YlGnBu",
"highlightColor": "#ffffcc",
"opacity": 0.9,
"scaleType": "linear"
}
}