Members

tip

The tip parameter allows to add tooltips on map layers

Properties
NameTypeDescription
tipstring | boolean | function

You can display a simple text like "foo". But in most cases, tooltips are used to display information related to the elements hovered over. To do this, use the $ prefix with the field name.With true, all fidls are displayed. Finally, you can pass a function to build a customized tooltip.

tipstyleobject

An object to configure the "appearance of the tooltip. fontSize, fill, background, stroke, strokeWidth, fontFamily, fontWeight, fontStyle, textDecoration. See also tool.addonts

Examples
// Simple text
viz.path({ data: world, tip: "hello" })
// A field to display
viz.path({ data: world, tip: "$pop" })
// To display all fields
viz.path({ data: world, tip: true })
// A tooltip on several lines
viz.path({
  data: world,
  fill: "#38896F",
  tip: `This country is $name
  It is located in $region
  Its population is $pop` 
  })
// A function
viz.path({
  data: world,
  fill: "#38896F",
  tip: (d) =>
    `There are ${Math.round(
      d.properties.pop / 1000000
    )} million inhabitants in ${d.properties.name}`
  })
// Custom style
viz.path({
  data: world,
  fill: "#CCC",
  tip: `$name ($ISO3)`,
  tipstyle: {
    fontSize: 20,
    fill: "white",
    background: "#38896F",
    stroke: "#4a4d4b",
    strokeWidth: 3,
    fontFamily: "Pacifico",
    fontWeight: "normal",
    fontStyle: "italic",
    textDecoration: "none"
  }
})

Methods

circle()

The circle function allows to add circles on a map. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection

idstring<optional>

id of the layer

posArray.<number><optional>
[0,0]

position of the circle to display a single circle

rnumber | string<optional>
10

a number or the name of a property containing numerical values

knumber<optional>
50

radius of the largest circle (or corresponding to the value defined by fixmax)

fixmaxnumber<optional>
null

value matching the circle with radius k. Setting this value is useful for making maps comparable with each other

dodgeboolean<optional>
false

to avoid circle overlap

iterationnumber<optional>
200

number of iteration to dodge circles

sortstring | function<optional>

the field to sort circles or a sort function

descendingboolean<optional>

circle sorting order

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document

fillstring | function<optional>

fill color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokestring | function<optional>
"white"

stroke color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

tipboolean | function<optional>
false

a function to display the tip. Use true tu display all fields

viewboolean<optional>

use true and viewof in Observable for this layer to act as Input

tipstyleobject<optional>

tooltip style

**<optional>

other SVG attributes that can be applied (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.circle(svg, { pos: [10,20], r: 15 }) // a single circle
geoviz.circle(svg, { data: cities, r: "population" }) // where svg is the container
svg.circle({ data: cities, r: "population" }) // where svg is the container
svg.plot({ type: "circle", data: cities, r: "population" }) // where svg is the container
geoviz.circle({ data: cities, r: "population" }) // no container
geoviz.plot({ type = "circle", data: cities, r: "population" }) // no container

create()

The create function is the first step in map construction. It creates an svg container + some information about this container:projection, margin, width, height and bbox.

Properties
NameTypeAttributesDefaultDescription
widthnumber<optional>
1000

width of the container.

idnumber<optional>
"map"

id of the svg container.

heightnumber<optional>

height of the container. This value is automatically calculated according to domain. But it can be forced by entering a value.

domainobject | Array.<object><optional>

the domain corresponds to the geographical area to be displayed. It is defined by a geoJSON or an array containing geoJSONs.

projectionfunction | string<optional>

d3 function of projection. See d3-geo & d3-geo-projection. You can aslo write "mercator" to use tiles. (default: "none")

posArray.<number><optional>

position of the container (if contained in another svg container)

backgroundstring<optional>

background color

fontFamilystring<optional>

font-family for the entire map

marginnumber | Array.<number><optional>
0

margins around the map. A number to set the same margin everywhere or an array [top, right, bottom, left] to set different margins.

parentobject<optional>

name of parent container into which this child container is to be included. In this case, the options.pos parameter is also used.

zoomableboolean | number | string<optional>

activates the map zoom function. If you set an array of 2 values, it defines the scaleExtent (default: [1,8]). Use "versor" to activate versor zoom. "versor" is only available for vector geometries in wgs84.

controlboolean | Array.<number><optional>

If zoomable is enabled, set the control parameter as true displays control buttons to zoom on the map. You can also define an array of 2 values to locate the panel in the position you want (e.g. [100, 200]). This setting is not available with the Versor zoom.

warningboolean<optional>
true

display or not warnings on the map

Example
let svg = geoviz.create({width: 500, background: "lightblue"})

draw()

The draw() function is inspired by the bertin library. It allows you to draw the entire map using a single function. All the necessary information is stored in a single JSON, containing general parameters and an array of objects describing the layers to be displayed and overlaid. Under the wood, the function draw() use the viz.plot() function. The types available are the same.

Properties
NameTypeDescription
jsonobject

an object containing container parameters and an array for layers description. See example below.

Example
geoviz.draw({
 // SVG container parameters
  params: {
    zoomable: true,
    projection: d3.geoNaturalEarth1()
  },
 // Layers description
  layers: [
    { type: "outline" },
    { type: "graticule", stroke: "white", step: 30, strokeWidth: 2 },
    { type: "base", datum: world, fill: "white", fillOpacity: 0.3 },
    {
      type: "prop",
      data: world,
      symbol: "circle",
      var: "gdp",
      fill: "red",
      tip: true,
      leg_values_factor: 1 / 1000000000,
      leg_title: "Gross Domestic Product"
    },
    { type: "header", text: "World Wealth" }
  ]
})

effect/blur()

The blur function allows to create a svg blur filter. It adds a filter to the defs and returns the id like "url(#id)".

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id

stdDeviationnumber<optional>
1.5

standard deviation

Example
// There are several ways to use this function
geoviz.effect.blur(svg, { stdDeviation: 0, id: "blur" }) // where svg is the container
svg.effect.blur({ stdDeviation: 0, id: "blur" }) // where svg is the container
svg.plot({ type: "blur", stdDeviation: 0, id: "blur" }) // where svg is the container

effect/clipPath()

The clipPath function allows to create a clip layer. The function adds a clip layer to the SVG container and returns the id like "url(#id)". WARNING - the clip is valid for the entireweb page, not just the map

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

clip id.

datumobject<optional>
{ type: "Sphere" }

datum to clip

permanentstring<optional>
false

boolean to have ore not a static clippath

Example
// There are several ways to use this function
geoviz.effect.clipPath(svg, { datum: world })  // where svg is the container
svg.effect.clipPath({ datum: world })  // where svg is the container
svg.plot({ type:"clipPath", datum: world })  // where svg is the container

effect/radialGradient()

The radialGradient function allows to create a radialGradient. The function adds a filter to the defs and returns the id like "url(#id)".

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id

color1Number<optional>
"#63b0af"

color 1

color2Number<optional>
"#428c8b"

color 2

offset1Number<optional>
50

offset 1

offset2Number<optional>
100

offset 2

fxNumber<optional>
50

fx

fyNumber<optional>
50

fy

Example
// There are several ways to use this function
geoviz.effect.radialGradient(svg, { id: "radial", color1: "red", color2: "blue" }) // where svg is the container
svg.effect.radialGradient({ id: "radial", color1: "red", color2: "blue" }) // where svg is the container
svg.plot({ type:"radialGradient",  id: "radial", color1: "red", color2: "blue" }) // where svg is the container

effect/shadow()

The shadow function allows to create a svg filter. It can be use ta add a shadow effect. The function adds a filter to the defs and returns the id like "url(#id)".

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id

dxstring<optional>
4

shift in x

dystring<optional>
4

shift in y

fillstring<optional>
"black"

fill color

fillOpacitynumber<optional>
0.5

fill-opacity (you can use also opacity)

stdDeviationnumber<optional>
1.5

standard deviation

opacitynumber<optional>
1

opacity

Example
// There are several ways to use this function
geoviz.effect.shadow(svg, { stdDeviation: 0, id: "blur" }) // where svg is the container
svg.effect.shadow({ stdDeviation: 2, id: "shadow" }) // where svg is the container
svg.plot({type:"shadow", stdDeviation: 2, id: "shadow" }) // where svg is the container

The footer function allows add a source below the map. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id of the layer

textstring<optional>
"Author, source..."

text to be displayed

fillstring<optional>
"#9e9696"

text fill

background_fillstring<optional>
"white"

background fill

background_strokestring<optional>
"white"

background stroke

background_strokeWidthstring<optional>
1

background stroke-width

dominantBaselinestring<optional>
"central"

text dominant-baseline ("hanging", "middle", "central", "bottom")

textAnchorstring<optional>
"middle"

text text-anchore ("start", "middle", "end")

lineSpacingnumber<optional>
0

space between lines

marginnumber<optional>
1

margin

fontSizenumber<optional>
10

text font-size

fontFamilystring<optional>
fontFamily defined in the contrainer

text font-family

dxnumber<optional>
0

shift in x

dynumber<optional>
0

shift in y

Example
// There are several ways to use this function
geoviz.footer(svg, { text: "Hello geoviz" }) // where svg is the container
svg.footer({ text: "Hello geoviz" }) // where svg is the container
svg.plot({ type: "footer", text: "Hello geoviz" }) // where svg is the container
geoviz.footer({ text: "Hello geoviz" }) // no container

graticule()

The graticule function allows to create a layer with lat/long lines. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id of the layer

stepnumber | Array.<number><optional>
10

gap between graticules. The value can be a number or an array of two values

strokestring<optional>
"#9ad5e6"

stroke color

fillstring<optional>
"none"

fill color

strokeWidthstring<optional>
0.8

stroke width

strokeLinecapstring<optional>
"square"

stroke-inecap

strokeLinejoinstring<optional>
"round"

stroke-Linejoin

strokeDasharraynumber | Array.<number><optional>
2

stroke-dasharray (default: 2)

**<optional>

other attributes that can be used to define the svg style (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.graticule(svg, { step: 2 }) // where svg is the container
svg.graticule({ step: [10,2] }) // where svg is the container
svg.plot({ type: "graticule", step: [10,2] }) // where svg is the container
geoviz.graticule({ step: 2 }) // no container

grid/arbitrary()

The grid.arbitrary function allows to create an arbitrary geoJSON grid in SVG coordinates.

Properties
NameTypeAttributesDefaultDescription
stepnumber<optional>
50

step of the grid

widthnumber<optional>
1000

width of the grid

heightnumber<optional>
500

height of the grid

Example
geoviz.grid.arbitrary({step: 30})

grid/diamond()

The grid.diamond function allows to create a diamond geoJSON grid in SVG coordinates.

Properties
NameTypeAttributesDefaultDescription
stepnumber<optional>
50

step of the grid

widthnumber<optional>
1000

width of the grid

heightnumber<optional>
500

height of the grid

Example
geoviz.grid.diamond({step: 30})

grid/dot()

The grid.dot function allows to create a geoJSON vith regular dots in SVG coordinates.

Properties
NameTypeAttributesDefaultDescription
stepnumber<optional>
50

step of the grid

widthnumber<optional>
1000

width of the grid

heightnumber<optional>
500

height of the grid

Example
geoviz.grid.dot({step: 30})

grid/h3()

The grid.h3 function allows to create a hexbin geoJSON grid in geographical coordinates.

Properties
NameTypeAttributesDefaultDescription
levelnumber<optional>
0

level of the grid. Form 0 (large hexagons) to 4 (small hexagons). See: https://h3geo.org

domainobject<optional>

a geoJSON to define an extent

rewindboolen<optional>

to rewind the output

Example
geoviz.grid.h3({level: 1})
geoviz.grid.h3({level: 4, domain: italy})

grid/hexbin()

The grid.hexbin function allows to create a hexbin geoJSON grid in SVG coordinates.

Properties
NameTypeAttributesDefaultDescription
stepnumber<optional>
50

step of the grid

widthnumber<optional>
1000

width of the grid

heightnumber<optional>
500

height of the grid

Example
geoviz.grid.hexbin({step: 30})

grid/make()

The grid.make function allows to create a regular grid geoJSON. For all types, For all grid types (except "h3"), the function returns a geojson with svg coordinates in the layout of the page. For type "h3", the function returns geographic coordinates in latitude and longitude.

Properties
NameTypeAttributesDefaultDescription
typestring<optional>
"square"

Type of grid ("square", "dot", "diamond", "hexbin" (or "hex"), "trangle", "arbitrary" (or "randmon"), "h3" (or "h3geo", "hexgeo", "hexbingeo"))

stepnumber<optional>
50

step of grids (except for "h3" type)

levelnumber<optional>
0

level oh geographical hexbin grids ("h3" type only). Form 0 (large hexagons) to 4 (small hexagons). See: https://h3geo.org

domainobject<optional>

a geoJSON to define an extent (h3 only)

rewindboolen<optional>

to rewind the output (h3 only)

Example
// There are several ways to use this function
geoviz.grid.make(svg, { type:"diamond", step:100 })  // where svg is the container
svg.grid.make({ type:"diamond", step:100 })  // where svg is the container

grid/square()

The grid.square function allows to create a square geoJSON grid in SVG coordinates.

Properties
NameTypeAttributesDefaultDescription
stepnumber<optional>
50

step of the grid

widthnumber<optional>
1000

width of the grid

heightnumber<optional>
500

height of the grid

Example
geoviz.grid.square({step: 30})

grid/triangle()

The grid.triangle function allows to create a triangle geoJSON grid in SVG coordinates.

Properties
NameTypeAttributesDefaultDescription
stepnumber<optional>
50

step of the grid

widthnumber<optional>
1000

width of the grid

heightnumber<optional>
500

height of the grid

Example
geoviz.grid.triangle({step: 30})

halfcircle()

The halfcircle function allows to create a layer with rotable half-circles from a geoJSON. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection

idstring<optional>

id of the layer

posArray.<number><optional>
[0,0]

position of the half-circle to display a single circle

dxnumber<optional>
0

shift in x

dynumber<optional>
0

shift in y

anglenumber<optional>
0

angle of the half circle

rnumber | string<optional>
10

a number or the name of a property containing numerical values

innerRadiusnumber<optional>
10

inner radius

cornerRadiusnumber<optional>
2

corner radius

knumber<optional>
50

radius of the largest half-circle (or corresponding to the value defined by fixmax)

fixmaxnumber<optional>

value matching the half-circle with radius k. Setting this value is useful for making maps comparable with each other

sortstring | function<optional>

the field to sort circles or a sort function

descendingboolean<optional>

circle sorting order

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document

fillstring | function<optional>

fill color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokestring | function<optional>

stroke color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

tipboolean | function<optional>
false

a function to display the tip. Use true tu display all fields

viewboolean<optional>
false

use true and viewof in Observable for this layer to act as Input

tipstyleobject<optional>

tooltip style

**<optional>

other SVG attributes that can be applied (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.halfcircle(svg, { pos: [10,20], r: 15 }) // a single half-circle
geoviz.halfcircle(svg, { data: cities, r: "population" }) // where svg is the container
svg.halfcircle({ data: cities, r: "population" }) // where svg is the container
svg.plot({ type: "halfcircle", data: cities, r: "population" }) // where svg is the container
geoviz.halfcircle({ data: cities, r: "population" }) // no container

The header function allows add a title above the map. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id of the layer

textstring<optional>
"Map title"

text to be displayed

fillstring<optional>
"#9e9696"

text fill

background_fillstring<optional>
"white"

background fill

background_strokestring<optional>
"white"

background stroke

background_strokeWidthstring<optional>
1

background stroke-width

dominantBaselinestring<optional>
"central"

text dominant-baseline ("hanging", "middle", "central", "bottom")

textAnchorstring<optional>
"middle"

text text-anchore ("start", "middle", "end")

lineSpacingnumber<optional>
0

space between lines

marginnumber<optional>
8

margin

fontSizenumber<optional>
26

text font-size

fontFamilystring<optional>
fontFamily defined in the contrainer

text font-family

dxnumber<optional>
0

shift in x

dynumber<optional>
0

shift in y

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.header(svg, { text: "Hello geoviz" }) // where svg is the container
svg.header({ text: "Hello geoviz" }) // where svg is the container
svg.plot({ type: "header",text: "Hello geoviz" }) // where svg is the container
geoviz.header({ text: "Hello geoviz" }) // no container

legend/box()

The legend.box function allows to add a box legend on a map. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

rect_widthstring<optional>
25

width of the box

rect_heightstring<optional>
17

height of the box

rect_fillstring<optional>
"#5d6266"

box color

rect_strokestring<optional>
"#303030"

stroke color

rect_strokeWidthstring<optional>
0.1

stroke width

rect_**<optional>

other SVG attributes that can be applied on this rect element (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

labelstring<optional>

text diplayed

label_fillstring<optional>
"#363636"

text color

label_fontSizestring<optional>
10

text size

label_dxstring<optional>
5

dx

label_dominantBaselinestring<optional>
"central"

dominant-baseline

label_**<optional>

SVG attributes that can be applied on this text element (fill, fontize...)

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.box(svg, { pos: [10,20], label:"hello" }) // where svg is the container
svg.legend.box(s{ pos: [10,20], label:"hello" }) // where svg is the container
svg.legend.box({type:"leg_box", pos: [10,20], label:"hello" }) // where svg is the container
geoviz.legend.box({ label:"hello" }) // no container

legend/choro_horizontal()

The legend.choro_horizontal function allows to add an horizontal legend on a map for choropleth layers. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

breaksArray.<number><optional>
[1, 2, 3, 4, 5]

breaks

colorsArray.<string><optional>
["#fee5d9", "#fcae91", "#fb6a4a", "#cb181d"]

colors

rect_widthstring<optional>
50

width of the box

rect_heightstring<optional>
14

height of the box

rect_spacingnumber<optional>
0

spacing between boxes

rect_fillstring<optional>
"#5d6266"

box color

rect_strokestring<optional>
"#303030"

stroke color

rect_strokeWidthstring<optional>
0.1

stroke width

rect_**<optional>

other SVG attributes that can be applied on this rect element (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

values_textAnchorstring<optional>
"middle"

text-anchor

values_dxnumber<optional>
0

shift in x

values_dxnumber<optional>
5

shift in y

values_fontSizestring<optional>
10

text size

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>

fontSize

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.choro_horizontal(svg, { pos: [10,20], breaks, colors}) // where svg is the container
svg.legend.choro_horizontal({pos: [10,20], breaks, colors} }) // where svg is the container
svg.plot({type: "leg_choro_horizontal", pos: [10,20], breaks, colors} }) // where svg is the container
geoviz.legend.choro_horizontal({ pos: [10,20], breaks, colors}) // no container

legend/choro_vertical()

The legend.choro_vertical function allows to add a vertical legend on a map for choropleth layers. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

breaksArray.<number><optional>
[1, 2, 3, 4, 5]

breaks

colorsArray.<string><optional>
["#fee5d9", "#fcae91", "#fb6a4a", "#cb181d"]

colors

rect_widthstring<optional>
25

width of the box

rect_heightstring<optional>
17

height of the box

rect_spacingnumber<optional>
0

spacing between boxes

rect_fillstring<optional>
"#5d6266"

box color

rect_strokestring<optional>
"#303030"

stroke color

rect_strokeWidthstring<optional>
0.1

stroke width

rect_**<optional>

other SVG attributes that can be applied on this rect element (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

values_textAnchorstring<optional>
"middle"

text-anchor

values_dxnumber<optional>
5

shift in x

values_dxnumber<optional>
0

shift in y

values_fillnumber<optional>
"#363636"

fill

values_fontSizestring<optional>
10

text size

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

values_**<optional>

SVG attributes that can be applied on this text element (fill, fontSize...)

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.choro_vertical(svg, { pos: [10,20], breaks, colors}) // where svg is the container
svg.legend.choro_vertical({pos: [10,20], breaks, colors} }) // where svg is the container
svg.plot({type:"leg_choro_vertical", pos: [10,20], breaks, colors} }) // where svg is the container
geoviz.legend.choro_vertical({ pos: [10,20], breaks, colors}) // no container

legend/circles()

The legend.circles function allows to add an legend for proportional circles. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

dataArray.<number>

input values

knumber<optional>
50

radius of the largest circle (or corresponding to the value defined by fixmax )

fixmaxArray.<string><optional>
null

value matching the circle with radius k . Setting this value is useful for making maps comparable with each other

nbnumber<optional>
4

number of circles

circle_fillstring<optional>
"none"

fill color for the circles

circle_strokestring<optional>
"#363636"

stroke color for the circles

circle_spacingstring<optional>
5

spacing between circles color for the circles

circle_**<optional>

*SVG attributes that can be applied on this circle element *

line_strokestring<optional>
"#363636"

stroke color for the lines

line_strokeDasharraystring<optional>
1

stroke-dasharray

line_strokeWidthstring<optional>
0.7

stroke-width

line_lengthstring<optional>
10

length of the line

line_**<optional>

*SVG attributes that can be applied on this line element *

values_textAnchorstring<optional>
"start"

text-anchor

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.circles(svg, { pos: [10,20], data, nb:5}) // where svg is the container
svg.legend.circles({pos: [10,20], data, nb: 5} }) // where svg is the container
svg.plot({type: "leg_circles", pos: [10,20], data, nb: 5} }) // where svg is the container
geoviz.legend.circles({ pos: [10,20], data, nb: 5}) // no container

legend/circles_half()

The legend.circles_half function allows to add an legend for mushroom maps. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

dataArray.<number><optional>
[30, 1000]

input values

knumber<optional>
50

radius of the largest half-circle (or corresponding to the value defined by fixmax ) (default: 50)

fixmaxArray.<string><optional>
null

value matching the circle with radius k . Setting this value is useful for making maps comparable with each other

nbnumber<optional>
4

number of half-circles

circle_fillstring<optional>
"none"

fill color for the half-circles

circle_strokestring<optional>
black

stroke color for the half-circles

circle_cornerRadiusnumber<optional>
5

circle_cornerRadius (default: 5)

circle_**<optional>

SVG attributes that can be applied on this half-circle element

line_strokestring<optional>
"#363636"

stroke color for the lines

line_strokeDasharraystring<optional>
1

stroke-dasharray

line_strokeWidthstring<optional>
0.7

stroke-width

line_lengthstring<optional>
10

length of the line

line_****<optional>

*SVG attributes that can be applied on this line element *

values_textAnchorstring<optional>
"middle"

text-anchor

values_dxnumber<optional>
0

shift in x

values_dxnumber<optional>
5

shift in y

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.circles_half(svg, { pos: [10,20], data, nb:5}) // where svg is the container
svg.legend.circles_half({pos: [10,20], data, nb: 5} }) // where svg is the container
svg.plot({type: "leg_circles_half", pos: [10,20], data, nb: 5} }) // where svg is the container
geoviz.legend.circles_half({ pos: [10,20], data, nb: 5}) // no container

legend/circles_nested()

The legend.circles_nested function allows to add an legend for proportional circles. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

dataArray.<number>

input values

knumber<optional>
50

radius of the largest circle (or corresponding to the value defined by fixmax )

fixmaxArray.<string><optional>
null

value matching the circle with radius k . Setting this value is useful for making maps comparable with each other

nbnumber<optional>
4

number of circles

circle_fillstring<optional>
"none"

fill color for the circles

circle_strokestring<optional>
"#363636"

stroke color for the circles

circle_**<optional>

*SVG attributes that can be applied on this circle element *

line_strokestring<optional>
"#363636"

stroke color for the lines

line_strokeDasharraystring<optional>
1

stroke-dasharray

line_strokeWidthstring<optional>
0.7

stroke-width

line_lengthstring<optional>
10

length of the line

line_****<optional>

*SVG attributes that can be applied on this line element *

values_textAnchorstring<optional>
"start"

text-anchor

values_dxnumber<optional>
5

shift in x

values_dynumber<optional>
0

shift in y

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.circles_nested(svg, { pos: [10,20], data, nb:5}) // where svg is the container
svg.legend.circles_nested({pos: [10,20], data, nb: 5} }) // where svg is the container
svg.plot({type: "leg_circles_nested", pos: [10,20], data, nb: 5} }) // where svg is the container
geoviz.legend.circles_nested({ pos: [10,20], data, nb: 5}) // no container

legend/mushrooms()

The legend.mushrooms function allows to add an legend for proportional half-circles. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

line_strokestring<optional>
"#363636"

stroke color for the lines

line_strokeDasharraystring<optional>
1

stroke-dasharray

line_strokeWidthstring<optional>
0.7

stroke-width

line_lengthstring<optional>
10

length of the line

line_**<optional>

*SVG attributes that can be applied on this line element nt

top_dataArray.<number><optional>

input values (top for circles)

top_knumber<optional>
50

radius of the largest top half-circle (or corresponding to the value defined by fixmax)

top_fixmaxArray.<string><optional>
null

value matching the top circle with radius k . Setting this value is useful for making maps comparable with each other

top_nbnumber<optional>
4

number of top half-circles

top_circle_fillstring<optional>
"none"

fill color for the top half-circles

top_circle_strokestring<optional>
"black"

stroke color for the top half-circles

top_circle_cornerRadiusnumber<optional>
5

top circle_cornerRadius

top_circle_**<optional>

SVG attributes that can be applied on this top half-circle element

top_values_textAnchorstring<optional>
"middle"

top text-anchor

top_values_dxnumber<optional>
5

shift in x

top_values_dynumber<optional>
0

shift in y

top_values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

top_values_decimalstring<optional>
"."

separator for decimals

top_values_thousandsstring<optional>
" "

separator for thousands

top_values_**<optional>

SVG attributes that can be applied on this text element (fill, fontSize...)

top_titlestring<optional>
"top_title"

title of the top elment

bottom_dataArray.<number><optional>

input values (bottom for circles)

bottom_knumber<optional>
50

radius of the largest bottom half-circle (or corresponding to the value defined by fixmax)

bottom_fixmaxArray.<string><optional>
null

value matching the bottom circle with radius k . Setting this value is useful for making maps comparable with each other

bottom_nbnumber<optional>
4

number of bottom half-circles

bottom_circle_fillstring<optional>
"none"

fill color for the bottom half-circles

bottom_circle_strokestring<optional>
"black"

stroke color for the bottom half-circles

bottom_circle_cornerRadiusnumber<optional>
5

bottom circle_cornerRadius

bottom_circle_**<optional>

SVG attributes that can be applied on this bottom half-circle element

bottom_values_textAnchorstring<optional>
"middle"

bottom text-anchor

bottom_values_dxnumber<optional>
5

shift in x

bottom_values_dynumber<optional>
0

shift in y

bottom_values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

bottom_values_decimalstring<optional>
"."

separator for decimals

bottom_values_thousandsstring<optional>
" "

separator for thousands

bottom_values_**<optional>

SVG attributes that can be applied on this text element (fill, fontSize...)

bottom_titlestring<optional>
"bottom_title"

title of the bottom elment

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.mushrooms(svg, { pos: [10,20],top_data, bottom_data}) // where svg is the container
svg.legend.mushrooms({pos: [10,20], top_data, bottom_data} }) // where svg is the container
svg.plot({ type: "leg_mushrooms", pos: [10,20], top_data, bottom_data} }) // where svg is the container
geoviz.legend.mushrooms({ pos: [10,20], top_data, bottom_data}) // no container

legend/spikes()

The legend.spikes function allows to add an legend for spike marks. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

dataArray.<number><optional>
[1, 1000]

input values

knumber<optional>
50

height of the highest spike (or corresponding to the value defined by fixmax ) (default: 100)

fixmaxArray.<string><optional>
null

value matching the spike with height k . Setting this value is useful for making maps comparable with each other

nbnumber<optional>
4

number of spikes

spike_widthnumber<optional>
30

a number defining the width of the spikes

spike_straightnumber<optional>
0

a number between 0 and 1 defining the curve of the spikes. 0 = curved ; 1 = straight

spike_spacingnumber<optional>
3

spacing between spikes (default: 3)

spike_fillstring<optional>
"none"

fill color for the cspikesrcles

spike_strokestring<optional>
"black"

stroke color for the spikes

spike_**<optional>

SVG attributes that can be applied on this spike element

values_textAnchorstring

text-anchor (default: "middle")

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.spikes(svg, { pos: [10,20], data, nb:5}) // where svg is the container
svg.legend.spikes({pos: [10,20], data, nb: 5} }) // where svg is the container
svg.plot({type: "spikes", pos: [10,20], data, nb: 5} }) // where svg is the container
geoviz.legend.spikes({ pos: [10,20], data, nb: 5}) // no container

legend/squares()

The legend.squares function allows to add an legend for proportional squares. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

dataArray.<number>

input values

knumber<optional>
100

side of the largest square (or corresponding to the value defined by fixmax )

fixmaxArray.<string><optional>
null

value matching the square with size k . Setting this value is useful for making maps comparable with each other

nbnumber<optional>
4

number of squares

square_fillstring<optional>
"none"

fill color for the squares

square_strokestring<optional>
"#363636"

stroke color for the squares

square_spacingstring<optional>
5

spacing between squares

square_**<optional>

*SVG attributes that can be applied on this square element *

line_strokestring<optional>
"#363636"

stroke color for the lines

line_strokeDasharraystring<optional>
1

stroke-dasharray

line_strokeWidthstring<optional>
0.7

stroke-width

line_lengthstring<optional>
10

length of the line

line_**<optional>

*SVG attributes that can be applied on this line element *

values_textAnchorstring<optional>
"start"

text-anchor

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.squares(svg, { pos: [10,20], data, nb:5}) // where svg is the container
svg.legend.squares({pos: [10,20], data, nb: 5} }) // where svg is the container
svg.plot({type: "leg_squares", pos: [10,20], data, nb: 5} }) // where svg is the container
geoviz.legend.squares({ pos: [10,20], data, nb: 5}) // no container

legend/squares_nested()

The legend.squares_nested function allows to add an legend for proportional squares. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

dataArray.<number>

input values

knumber<optional>
100

side of the largest square (or corresponding to the value defined by fixmax )

fixmaxArray.<string><optional>
null

value matching the square with size k . Setting this value is useful for making maps comparable with each other

nbnumber<optional>
4

number of squares

square_fillstring<optional>
"none"

fill color for the squares

square_strokestring<optional>
"#363636"

stroke color for the squares

square_spacingstring<optional>
5

spacing between squares

square_**<optional>

*SVG attributes that can be applied on this square element *

line_strokestring<optional>
"#363636"

stroke color for the lines

line_strokeDasharraystring<optional>
1

stroke-dasharray

line_strokeWidthstring<optional>
0.7

stroke-width

line_lengthstring<optional>
10

length of the line

line_**<optional>

*SVG attributes that can be applied on this line element *

values_textAnchorstring<optional>
"start"

text-anchor

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

values_factornumber<optional>
1

allow to multiply values to display in the legend. e.g 0.001 to convert into thousands

values_decimalstring<optional>
"."

separator for decimals

values_thousandsstring<optional>
" "

separator for thousands

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.squares_nested(svg, { pos: [10,20], data, nb:5}) // where svg is the container
svg.legend.squares_nested({pos: [10,20], data, nb: 5} }) // where svg is the container
svg.plot({type: "leg_squares_nested", pos: [10,20], data, nb: 5} }) // where svg is the container
geoviz.legend.squares_nested({ pos: [10,20], data, nb: 5}) // no container

legend/symbol_horizontal()

The legend.symbol_horizontal function allows to add an vertical legend on a map for symbol layers. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

typesArray.<string><optional>
["A", "B", "C", "D"]

types

symbolsArray.<string><optional>
["circle", "square", "triangle", "pentagon"]

symbols

alphabeticalboolean<optional>
true

alphabetical order

symbol_sizenumber<optional>
10

size of the symbol (radius)

symbol_rotatenumber<optional>
0

angle of the symbols

symbol_spacingnumber<optional>
4

spacing between symbols

symbol_fillstring<optional>
"#2e2e2e"

box color

symbol_strokestring<optional>
"#303030"

stroke color

symbol_strokeWidthstring<optional>
0.5

stroke width

symbol_foo*

other SVG attributes that can be applied on this symbol element (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

symbol_backgroundboolen<optional>
false

circles under the symbol

symbol_background_foo*

*other SVG attributes that can be applied on this circle element (fill, stroke, fillOpacity...)

values_textAnchorstring

text-anchor (default: "middle")

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.typo_horizontal(svg, { pos: [10,20], types, colors}) // where svg is the container
svg.legend.typo_horizontal({pos: [10,20], types, colors} }) // where svg is the container
svg.plot({type: "leg_typo_horizontal", pos: [10,20], types, colors} }) // where svg is the container
geoviz.legend.typo_horizontal({ pos: [10,20], types, colors}) // no container

legend/symbol_vertical()

The legend.symbol_vertical function allows to add an vertical legend on a map for symbol layers. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

typesArray.<string><optional>
["A", "B", "C", "D"]

types

symbolsArray.<string><optional>
["circle", "square", "triangle", "pentagon"]

symbols

alphabeticalboolean<optional>
true

alphabetical order

symbol_sizenumber<optional>
10

size of the symbol (radius)

symbol_rotatenumber<optional>
0

angle of the symbols

symbol_spacingnumber<optional>
4

spacing between symbols

symbol_fillstring<optional>
"#2e2e2e"

box color

symbol_strokestring<optional>
"#303030"

stroke color

symbol_strokeWidthstring<optional>
0.5

stroke width

symbol_foo*

other SVG attributes that can be applied on this symbol element (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

symbol_backgroundboolen<optional>
false

circles under the symbol

symbol_background_foo*

*other SVG attributes that can be applied on this circle element (fill, stroke, fillOpacity...)

values_textAnchorstring

text-anchor (default: "middle")

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.typo_vertical(svg, { pos: [10,20], types, colors}) // where svg is the container
svg.legend.typo_vertical({pos: [10,20], types, colors} }) // where svg is the container
svg.plot({type: "leg_typo_vertical", pos: [10,20], types, colors} }) // where svg is the container
geoviz.legend.typo_vertical({ pos: [10,20], types, colors}) // no container

legend/typo_horizontal()

The legend.typo_horizontal function allows to add an horizontal legend on a map for typo layers. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

typesArray.<string><optional>
["A", "B", "C", "D"]

types

colorsArray.<string><optional>
["#e41a1c", "#377eb8", "#4daf4a", "#984ea3"]

colors

alphabeticalboolean<optional>
true

alphabetical order

rect_widthnumber<optional>
50

width of the box

rect_heightnumber<optional>
14

height of the box

rect_spacingnumber<optional>
0

spacing between boxes

rect_fillstring<optional>
"#5d6266"

box color

rect_strokestring<optional>
"#303030"

stroke color

rect_strokeWidthstring<optional>
0.1

stroke width

rect_foo*

other SVG attributes that can be applied on this rect element (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

values_textAnchorstring

text-anchor (default: "middle")

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function

legend/typo_vertical()

The legend.typo_vertical function allows to add an vertical legend on a map for typo layers. The function adds a legend layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

unique id

posArray.<number><optional>
[0,0]

legend position

gapnumber<optional>
2

gap between elements

typesArray.<string><optional>
["A", "B", "C", "D"]

types

colorsArray.<string><optional>
["#e41a1c", "#377eb8", "#4daf4a", "#984ea3"]

colors

alphabeticalboolean<optional>
true

alphabetical order

rect_widthnumber<optional>
25

width of the box

rect_heightnumber<optional>
17

height of the box

rect_spacingnumber<optional>
3

spacing between boxes

rect_fillstring<optional>
"#5d6266"

box color

rect_strokestring<optional>
"#303030"

stroke color

rect_strokeWidthstring<optional>
0.1

stroke width

rect_foo*

other SVG attributes that can be applied on this rect element (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

values_textAnchorstring

text-anchor (default: "middle")

values_dxnumber

shift in x (default: 0)

values_dxnumber

shift in y (default: 5)

values_fillnumber<optional>
"#363636"

fill

values_fontSizenumber<optional>
10

fontSize

titlestring<optional>
"Legend"

title of the legend

title_fillstring<optional>
"#363636"

title color

title_fontSizestring<optional>
16

title font size

title_**<optional>

SVG attributes that can be applied on this text element

subtitlestring<optional>

subtitle of the legend

subtitle_fillstring<optional>
"#363636"

subtitle color

subtitle_fontSizestring<optional>
12

subtitle font size

subtitle_**<optional>

SVG attributes that can be applied on this text element

notestring<optional>

note displayed above the legend

note_fillstring<optional>
"#363636"

note color

note_fontSizestring<optional>
1O

note font size

note_**<optional>

SVG attributes that can be applied on this text element

frameboolean<optional>
false

frame around the legend

frame_marginboolean<optional>
15

frame margin

frame_fillboolean<optional>
"white"

frame fill

frame_strokeboolean<optional>
"black"

frame fill

frame_fillOpacityboolean<optional>
0.5

frame fill-opacity

frame_**<optional>

SVG attributes that can be applied on this frame element (rect)

text_**<optional>

SVG attributes that can be applied directly on all text elements of this legend

Example
// There are several ways to use this function
geoviz.legend.typo_vertical(svg, { pos: [10,20], types, colors}) // where svg is the container
svg.legend.typo_vertical({pos: [10,20], types, colors} }) // where svg is the container
svg.plot({type: "leg_typo_vertical", pos: [10,20], types, colors} }) // where svg is the container
geoviz.legend.typo_vertical({ pos: [10,20], types, colors}) // no container

north()

The north function allows add a North arrow. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id of the layer

posArray.<number><optional>
[svg.width - 30, 30]

position [x,y] on the page. The scale value is relevant for this location on the map

scalenumber<optional>
1

a number to rescale the arrow

rotatenumber<optional>
null

an angle to rotate the arrow. By dedault, il is automaticaly calculated

fillstring<optional>
"black"

fill color

fillOpacitystring<optional>
1

fill-opacity

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.north(svg, { pos: [100, 300], fill: "brown" }) // where svg is the container
svg.north({ pos: [100, 300], fill: "brown" }) // where svg is the container
svg.plot({ type: "north", pos: [100, 300], fill: "brown" }) // where svg is the container
geoviz.north( { pos: [100, 300], fill: "brown" }) // no container

outline()

The outline function allows to create a layer with Earth outline in the projection. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id of the layer

strokestring<optional>
"none"

stroke color

strokeWidthnumber<optional>
1

stroke width

fillstring<optional>
"#B5DFFD"

fill color

**<optional>

other attributes that can be used to define the svg style (strokeDasharray, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.outline(svg, { fill: "yelllow" }) // where svg is the container
svg.outline({ fill: "yelllow" }) // where svg is the container
svg.plot({ type: "outline", fill: "yelllow" }) // where svg is the container
geoviz.outline({ fill: "yelllow" }) // no container

path()

The path function generates SVG paths from a geoJSON. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection. Use data to be able to iterate

datumobject

GeoJSON FeatureCollection. Use datum if you don't need to iterate.

idstring<optional>

id of the layer

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document

clipboolean<optional>
true

use true to clip the path with the outline

fillstring | function<optional>

fill color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokestring | function<optional>

stroke color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokeWidthstring | function<optional>
1

stroke-width (default: 1)

tipboolean | function<optional>
false

a function to display the tip. Use true tu display all fields

viewboolean<optional>

= false] - use true and viewof in Observable for this layer to act as Input

tipstyleobject<optional>

tooltip style

**<optional>

other SVG attributes that can be applied (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.path(svg, { data: world, fill: "red" }) // where svg is the container
svg.path({ data: world, fill: "red" }) // where svg is the container
svg.plot({ type: "path", data: world, fill: "red" }) // where svg is the container
geoviz.path({ data: world, fill: "red" }) // no container

plot()

The plot() function in geoviz allows you to call up all the layer types available in the library via a single function. To do this, you need to define the type in the parameter.

For example: geoviz.plot({type: "graticule", step: 30})

Properties
NameTypeAttributesDescription
chorostring

Usage: geoviz.plot({type: "choro", ...}) or {type: "choropleth"}. See plot/choro

typostring

Usage: geoviz.plot({type: "typo", ...}) or {type: "typology"}. See plot/typo

propstring

Usage: geoviz.plot({type: "prop", ...}). See plot/prop

propchorostring

Usage: geoviz.plot({type: "propchoro", ...}). See plot/propchoro

proptypostring

Usage: geoviz.plot({type: "proptypo", ...}). See plot/proptypo

outlinestring

Usage: geoviz.plot({type: "outline", ...}). See outline

graticulestring

Usage: geoviz.plot({type: "graticule", ...}). See graticule

pathstring

Usage: geoviz.plot({type: "path", ...}) or {type: "base"} or {type: "simple"}. See path

textstring

Usage: geoviz.plot({type: "text", ...}) or {type: "label"}. See text

circlestring

Usage: geoviz.plot({type: "circle", ...}). See circle

symbolstring

Usage: geoviz.plot({type: "symbol", ...}). See symbol

squarestring

Usage: geoviz.plot({type: "square", ...}). See square

halfcirclestring

Usage: geoviz.plot({type: "halfcircle", ...}). See halfcircle

spikestring

Usage: geoviz.plot({type: "spike", ...}). See spike

tilestring

Usage: geoviz.plot({type: "tile", ...}). See tile

headerstring

Usage: geoviz.plot({type: "header", ...}). See header

footerstring

Usage: geoviz.plot({type: "footer", ...}). See footer

scalebarstring

Usage: geoviz.plot({type: "scalebar", ...}). See scalebar

northstring

Usage: geoviz.plot({type: "north", ...}). See north

leg_boxstring

Usage: geoviz.plot({type: "leg_box", ...}) or {type: "legbox"}. See legend.box

leg_choro_horizontalstring

Usage: geoviz.plot({type: "leg_choro_horizontal", ...}) or {type: "legchorohorizontal"}. See legend.choro_horizontal

leg_choro_verticalstring

Usage: geoviz.plot({type: "leg_choro_vertical", ...}) or {type: "legchorovertical"} or {type: "leg_choro"} or {type: "legchoro"}. See legend.choro_vertical

leg_typo_horizontalstring

Usage: geoviz.plot({type: "leg_typo_horizontal", ...}) or {type: "legtypohorizontal"}. See legend.typo_horizontal

leg_typo_verticalstring

Usage: geoviz.plot({type: "leg_typo_vertical", ...}) or {type: "legtypovertical"} or {type: "leg_typo"} or {type: "legtypo"}. See legend.choro_vertical

leg_spikesstring

Usage: geoviz.plot({type: "leg_spikes", ...}) or {type: "leg_spikes"} or {type: "legspikes"} or {type: "legspike"}. See legend.spikes

leg_circlesstring

Usage: geoviz.plot({type: "leg_circles", ...}) or {type: "legcircle"} or {type: "legcircle"} or {type: "legcircles"}. See legend.circles

leg_circle_nestedstring

Usage: geoviz.plot({type: "leg_circle_nested", ...}) or {type: "legcirclenested"} or {type: "legcirclesnested"}. See legend.circles_nested

leg_mushroomsstring

Usage: geoviz.plot({type: "leg_mushrooms", ...}) or {type: "leg_mushroom"} or {type: "legmushrooms"} or {type: "legmushroom"}. See legend.mushrooms

effect_clipPathstring

Usage: geoviz.plot({type: "effect_clipPath", ...}) or {type: "clipPath"}. See effect.clipPath

effect_blurstring

Usage: geoviz.plot({type: "effect_blur", ...}) or {type: "blur"}. See effect.blur

effect_shadowstring

Usage: geoviz.plot({type: "effect_shadow", ...}) or {type: "shadow"}. See effect.shadow

effect_radialGradientstring

Usage: geoviz.plot({type: "effect_radialGradient", ...}) or {type: "radialGradient"}. See effect.radialGradient

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
let svg = geoviz.create({projection: d3.geoNaturalEarth1()})
svg.plot({ type = "outline" }) // outline layer
svg.plot({ type = "graticule", step:30, stroke: "white" }) // graticule layer
svg.plot({ type = "path", datum: world, fill: "white", fillOpacity:0.3 }) // path layer
svg.plot({ type = "header", text: "Hello World" }) // Map title
return svg.render()

plot/choro()

With the plot({type = "choro"}) function, you can quickly draw a choropleth map.

choro

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection. Use data to be able to iterate

varstring

a variable name in a geoJSON containig numeric values. You can also use fill or stroke argument.

methodstring<optional>
quantile

classification method ('quantile', 'q6', 'equal', 'jenks', 'msd', 'geometric', 'headtail', 'pretty', 'arithmetic' or 'nestedmeans').

nbnumber<optional>
6

number of classes

breaksarray<optional>

you can define classes manually. In this case, the parameters nb and method are not taken into account.

colorsstring | array<optional>

an array of colors or name of a color palette available in dicopal. For example "ArmyRose_7", "Earth_7", "Fall_7", "Geyser_7", "TealRose_7", "Temps_7", "Tropic_7", "BluGrn_7", "BluYl_7", "BrwnYl_7", "BurgYl_7", "Burg_7", "DarkMint_7", "Emrld_7", "Magenta_7", "Mint_7", "OrYel_7", "Peach_7", "PinkYl_7", "PurpOr_7"...

reverseboolean<optional>
false

reverse the color palette

missingstring | boolean<optional>
"white"

missing data color

legendboolean<optional>
true

boolean to add or not the legend

leg_typestring<optional>
"vertical"

legend orientation ("horizontal" or "vertical")

leg_posarray<optional>
[10, 10]

position of the legend

**<optional>

You can also modify numerous parameters to customize the map. To do this, you can use all the parameters of the path and tool.choro functions. For example: strokeWidth: 0.3.

leg_**<optional>

You can also modify a wide range of parameters to customize the legend. To do this, you can use all the parameters of the legend.choro_horizontal and legend.choro_vertical functions with the prefix "leg_". For example: leg_missing_text: "not available" or leg_values_fill: "red".

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// Usage
geoviz.plot({type:"choro", data: world, var: "gdppc"})

plot/prop()

With the plot({type = "prop"}) function, you can quickly draw a choropleth map.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection. Use data to be able to iterate

varstring

a variable name in a geoJSON containig numeric values.

symbolstring<optional>
"circle"

choice of the mark to plot ("circle", "square", "spike", "halfcircle")

knumber<optional>
50

size of the largest symbol

fixmaxnumber<optional>
null

value matching the symbol with value = k . Setting this value is useful for making maps comparable with each other.

widthnumber<optional>
30

a number defining the width of the spikes

straightnumber<optional>
0

a number between 0 and 1 defining the curve of the spikes. 0 = curved ; 1 = straight

dodgeboolean<optional>
false

to avoid circle overlap (noot relevant fot other marks)

legendboolean<optional>
true

boolean to add or not the legend

leg_typestring<optional>
"nested"

legend style ("nested" or "separate")

leg_posarray<optional>
[10, 10]

position of the legend

**<optional>

You can also modify numerous parameters to customize the map. To do this, you can use all the parameters of the path and tool.typo functions. For example: strokeWidth: 0.3.

leg_**<optional>

You can also modify a wide range of parameters to customize the legend. To do this, you can use all the parameters of the legend.circles_nested, legend.circles_half, legend.circles_nested and legend.spikes functions with the prefix "leg_". For example: leg_missing_text: "not available" or leg_values_fill: "red".

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// Usage
geoviz.plot({type:"prop", data: world, var: "pop"})

plot/propchoro()

With the plot({type = "propchoro"}) function, you can quickly draw a proportional symbols with a color gradation/

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection. Use data to be able to iterate

var1string

a variable name in a geoJSON containig numeric values (absolute quantitative data).

var2string

a variable name in a geoJSON containig numeric values (relative quantitative data. e.g. %).

varstring<optional>

If you set var instead of var1 and var2, then the same variable is mapped twice in two different ways.

symbolstring<optional>
"circle"

choice of the mark to plot ("circle", "spike", "halfcircle")

knumber<optional>
50

size of the largest symbol

fixmaxnumber<optional>
null

value matching the symbol with value = k . Setting this value is useful for making maps comparable with each other.

dodgeboolean<optional>
false

to avoid circle overlap (noot relevant fot other marks)

widthnumber<optional>
30

a number defining the width of the spikes

straightnumber<optional>
0

a number between 0 and 1 defining the curve of the spikes. 0 = curved ; 1 = straight

methodstring<optional>
quantile

classification method ('quantile', 'q6', 'equal', 'jenks', 'msd', 'geometric', 'headtail', 'pretty', 'arithmetic' or 'nestedmeans').

nbnumber<optional>
6

number of classes

breaksarray<optional>

you can define classes manually. In this case, the parameters nb and method are not taken into account.

colorsstring | array<optional>

an array of colors or name of a color palette available in dicopal

reverseboolean<optional>
false

reverse the color

missingstring | boolean<optional>
"white"

missing data color

**<optional>

You can also modify numerous parameters to customize the map. For example: strokeWidth: 0.3.

legendboolean<optional>
true

boolean to add or not the legend

leg1_typestring<optional>
"nested"

legend style ("nested" or "separate")

leg2_typestring<optional>
"vertical"

legend style ("vertical" or "horizontal")

leg1_posarray<optional>
[10, 10]

position of the legend

leg1_**<optional>

You can also modify a wide range of parameters to customize the legend. To do this, you can use all the parameters of the legend.circles_nested, legend.circles_half, legend.circles_nested and legend.spikes functions with the prefix "leg1_". For example: leg1_values_fill: "red".

leg2_**<optional>

You can also modify a wide range of parameters to customize the legend (choro). To do this, you can use all the parameters of the legend.choro_horizontal and legend.choro_vertical functions with the prefix "leg2_". For example: leg2_missing_text: "not available".

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// Usage
geoviz.plot({type:"propchoro", data: world, var1: "pop", var2: "gdppc"})

plot/proptypo()

With the plot({type = "proptypo"}) function, you can quickly draw a proportional symbols with qualitative colors (hues)

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection. Use data to be able to iterate

var1string

a variable name in a geoJSON containig numeric values (absolute quantitative data).

var2string

a variable name in a geoJSON containig numeric values (relative quantitative data. e.g. %).

varstring<optional>

If you set var instead of var1 and var2, then the same variable is mapped twice in two different ways.

symbolstring<optional>
"circle"

choice of the mark to plot ("circle", "spike", "halfcircle")

knumber<optional>
50

size of the largest symbol

fixmaxnumber<optional>
null

value matching the symbol with value = k . Setting this value is useful for making maps comparable with each other.

dodgeboolean<optional>
false

to avoid circle overlap (noot relevant fot other marks)

widthnumber<optional>
30

a number defining the width of the spikes

straightnumber<optional>
0

a number between 0 and 1 defining the curve of the spikes. 0 = curved ; 1 = straight

colorsstring | array<optional>

an array of colors or name of a color palette available in dicopal

orderarray<optional>

an array of values qualitative values.

alphabeticalboolean<optional>
true

to order the items in the legend in alphabetical order

missingstring | boolean<optional>
"white"

missing data color

**<optional>

You can also modify numerous parameters to customize the map. For example: strokeWidth: 0.3.

legendboolean<optional>
true

boolean to add or not the legend

leg1_typestring<optional>
"nested"

legend style ("nested" or "separate")

leg2_typestring<optional>
"vertical"

legend style ("vertical" or "horizontal")

leg1_posarray<optional>
[10, 10]

position of the legend

leg1_**<optional>

You can also modify a wide range of parameters to customize the legend. To do this, you can use all the parameters of the legend.circles_nested, legend.circles_half, legend.circles_nested and legend.spikes functions with the prefix "leg1_". For example: leg1_values_fill: "red".

leg2_**<optional>

You can also modify a wide range of parameters to customize the legend (choro). To do this, you can use all the parameters of the legend.typo_horizontal and legend.typo_vertical functions with the prefix "leg2_". For example: leg2_missing_text: "not available".

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// Usage
geoviz.plot({type:"propchoro", data: world, var1: "pop", var2: "gdppc"})

plot/symbol()

With the plot({type = "symbol"}) function, you can quickly draw a layer with symbols.

choro

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection. Use data to be able to iterate

varstring

a variable name in a geoJSON containig qualitative values. Or the name of a symbol.

symbolsarray<optional>

an array of symbols.

alphabeticalboolean<optional>
true

to order the items in the legend in alphabetical order

legendboolean<optional>
true

boolean to add or not the legend

leg_typestring<optional>
"vertical"

legend orientation ("horizontal" or "vertical")

leg_posarray<optional>
[10, 10]

position of the legend

**<optional>

You can also modify numerous parameters to customize the map. To do this, you can use all the parameters of the path and tool.typo functions. For example: strokeWidth: 0.3.

leg_**<optional>

You can also modify a wide range of parameters to customize the legend. To do this, you can use all the parameters of the legend.typo_horizontal and legend.typo_vertical functions with the prefix "leg_". For example: leg_missing_text: "not available" or leg_values_fill: "red".

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// Usage
geoviz.plot({type:"symbol", data: usa, var: "states"})

plot/typo()

With the plot({type = "typo"}) function, you can quickly draw a typlogy from qualitative data.

choro

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection. Use data to be able to iterate

varstring

a variable name in a geoJSON containig numeric values. You can also use fill or stroke argument.

colorsstring | array<optional>

an array of colors or name of a color palette available in dicopal. For example : "Antique_7", "Bold_7", "Pastel_7", "Prism_7", "Safe_7", "Vivid_7", "Accent_7", "Dark2_7", "Paired_7", "Pastel1_7", "Pastel2_7", "Set1_7", "Set2_7", "Set3_7"

orderarray<optional>

an array of values qualitative values.

alphabeticalboolean<optional>
true

to order the items in the legend in alphabetical order

missingstring | boolean<optional>
"white"

missing data color

legendboolean<optional>
true

boolean to add or not the legend

leg_typestring<optional>
"vertical"

legend orientation ("horizontal" or "vertical")

leg_posarray<optional>
[10, 10]

position of the legend

**<optional>

You can also modify numerous parameters to customize the map. To do this, you can use all the parameters of the path and tool.typo functions. For example: strokeWidth: 0.3.

leg_**<optional>

You can also modify a wide range of parameters to customize the legend. To do this, you can use all the parameters of the legend.typo_horizontal and legend.typo_vertical functions with the prefix "leg_". For example: leg_missing_text: "not available" or leg_values_fill: "red".

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// Usage
geoviz.plot({type:"typo", data: usa, var: "states"})

render()

The render function returns the svg document. It returns a pretty map in SVG format :-)

Properties
NameTypeAttributesDescription
svgSVGSVGElement

SVG container to display. This can be generated using the create function.

orderArray.<object><optional>

array determining the order of layers. This option is only useful in Observable notebooks (because of its topological nature).

Example
geoviz.render(svg, {order: [basemap, roads, cities]}) // where svg is the container
svg.render({order: [basemap, roads, cities]}) // where svg is the container

scalebar()

The scalebar function allows add a scalebar. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id of the layer

posArray.<number><optional>
10, svg.height - 20

position [x,y] on the page. The scale value is relevant for this location on the map

translateArray.<number><optional>
null

an array of two values to move the scalebar without change its size

unitsstring<optional>
"km"

"ft" (feet), "km" (kilometers), "m" (meters) or "mi" (miles)

labelstring<optional>

label to display

tickSizestring<optional>
5

tick padding

tickPaddingstring<optional>
0.2

tick size

distancenumber<optional>

distance represented by the scalebar

tickFormatfunction<optional>
d => d

a function to format values

tickValuesArray.<number><optional>

values to display on the scalebar

labelAnchorstring<optional>
"start"

position of the label ("start", "middle" or "end")

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.scalebar(svg, { units:"km", distance: 500, pos: [100, 200] }) // where svg is the container
svg.scalebar({ units:"km", distance: 500, pos: [100, 200] }) // where svg is the container
svg.plot({type: "scalebar", units:"km", distance: 500, pos: [100, 200] }) // where svg is the container

spike()

The spike function allows to create a layer with spikes from a geoJSON. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection

idstring<optional>

id of the layer

posArray.<number><optional>
[0,0]

position of the sîkes to display a single spike

heightnumber | string<optional>
10

a number or the name of a property containing numerical values

widthnumber<optional>
30

a number defining the width of the spikes

straightnumber<optional>
0

a number between 0 and 1 defining the curve of the spikes. 0 = curved ; 1 = straight

knumber<optional>
100

height of the highest spike (or corresponding to the value defined by fixmax)

fixmaxnumber<optional>

value matching the spikes with height k. Setting this value is useful for making maps comparable with each other

sortstring | function<optional>

the field to sort spikes or a sort function

descendingboolean<optional>

spikes sorting order

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document (default: "geo")

fillstring | function<optional>

fill color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokestring | function<optional>

stroke color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

tipboolean | function<optional>
false

a function to display the tip. Use true tu display all fields

viewboolean<optional>
false

use true and viewof in Observable for this layer to act as Input

tipstyleobject<optional>

tooltip style

**<optional>

other SVG attributes that can be applied (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.spike(svg, { pos: [10,20], height: 15 }) // a single circle
geoviz.spike(svg, { data: cities, height: "population" }) // where svg is the container
svg.spike({ data: cities, height: "population" }) // where svg is the container
svg.plot({ type: "spike", data: cities, height: "population" }) // where svg is the container
geoviz.spike({ data: cities, height: "population" }) // no container

square()

The square function allows to create a layer with rotable squares from a geoJSON. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection

idstring<optional>

id of the layer

posArray.<number><optional>
[0,0]

position of the square to display a single square

dxnumber<optional>
0

shift in x

dynumber<optional>
0

shift in y

anglenumber<optional>
0

angle of the square

sidenumber | string<optional>
20

a number or the name of a property containing numerical values

knumber<optional>
100

size of the largest square(or corresponding to the value defined by fixmax)

fixmaxnumber<optional>

value matching the square with size k. Setting this value is useful for making maps comparable with each other

sortstring | function<optional>

the field to sort squares or a sort function

descendingboolean<optional>

sorting order

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document

fillstring | function<optional>

fill color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokestring | function<optional>

stroke color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

tipboolean | function<optional>
false

a function to display the tip. Use true tu display all fields

viewboolean<optional>
false

use true and viewof in Observable for this layer to act as Input

tipstyleobject<optional>

tooltip style

**<optional>

other SVG attributes that can be applied (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.square(svg, { pos: [10,20], side: 15 }) // a single square
geoviz.square(svg, { data: cities, side: "population" }) // where svg is the container
svg.square({ data: cities, side: "population" }) // where svg is the container
svg.plot({ type: "square", data: cities, side: "population" }) // where svg is the container
geoviz.square({ data: cities, side: "population" }) // no container

symbol()

The symbol function allows to create a layer with symbols from a geoJSON. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection

idstring<optional>

id of the layer

posArray.<number><optional>
[0,0]

position of the sîkes to display a single spike

fillstring | function<optional>

fill color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokestring | function<optional>
"white"

stroke color

strokeWidthstring | function<optional>
0.2

stroke-width

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document (default: "geo")

rnumber | string<optional>
12

a radius to set the size one the symbol (encompassing circle)

scalenumber<optional>

the scale parameter allows you to change the scale of the symbol.

symbolstring<optional>
"star"

the name of the symbol to display (use viz.tool.symbols() to get the list of available symbols). Iy you use a fied, then a different symbol is assigned to each modality.

missingstring<optional>
"missing"

the name of the symbol for missig values. Use null to remove these symbols.

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document (default: "geo")

rotatenumber<optional>
0

to rotate symbols

skewXnumber<optional>
0

skewX

skewXnumber<optional>
0

skewY

backgroundboolean<optional>
false

to add a circle below the symbol

background_**<optional>

parameters of the background. You can use paramers like background_fill, background_stroke...

fillstring | function<optional>

fill color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

strokestring | function<optional>

stroke color. To create choropleth maps or typologies, use the tool.choro and tool.typo functions

tipboolean | function<optional>
false

a function to display the tip. Use true tu display all fields

viewboolean<optional>
false

use true and viewof in Observable for this layer to act as Input

tipstyleobject<optional>

tooltip style

knumber<optional>
50

radius of the largest circle (or corresponding to the value defined by fixmax)

fixmaxnumber<optional>
null

value matching the circle with radius k. Setting this value is useful for making maps comparable with each other

dodgeboolean<optional>
false

to avoid circle overlap

iterationnumber<optional>
200

number of iteration to dodge circles

sortstring | function<optional>

the field to sort circles or a sort function

descendingboolean<optional>

circle sorting order

**<optional>

other SVG attributes that can be applied (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.symbol(svg, { pos: [10,20], r: 15 }) // a single circle
geoviz.symbol(svg, { data: cities, r: "type" }) // where svg is the container
svg.symbol({ data: cities, r: "type" }) // where svg is the container
svg.plot({ type: "symbol", data: poi, r: "type" }) // where svg is the container
geoviz.symbol({ data: poi, r: "type" }) // no container

text()

The text function allows to add a text on the map. It allow also to create a layer with labels from a geoJSON. The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
dataobject

GeoJSON FeatureCollection

idstring<optional>

id of the layer

textstring | function<optional>
"text"

text to be displayed

textAnchorstring | function<optional>

text anchor ("start", "middle", "end")

dominantBaselinestring | function<optional>

dominant-baseline ("auto", "middle", "central", "hanging")

fontFamilystring<optional>
fontFamily defined in the svg container

font-family

fontSizenumber<optional>
12

font-size

lineSpacingnumber<optional>
0

line spacinf

posArray.<number><optional>
[0,0]

position to display a single text element

dxnumber<optional>
0

shift in x

dynumber<optional>
0

shift in y

sortstring | function<optional>

the field to sort labels or a sort function

descendingboolean<optional>

text sorting order

coordsstring<optional>
"geo"

use "svg" if the coordinates are already in the plan of the svg document

fillstring | function<optional>

fill color

strokestring | function<optional>

stroke color

strokeWidthnumber<optional>
1

stroke width

strokeLinejoinstring | function<optional>
"round"

stroke-linejoin

tipboolean | function<optional>
false

a function to display the tip. Use true tu display all fields

tipstyleobject<optional>
false

tooltip style

**<optional>

other SVG attributes that can be applied (strokeDasharray, strokeWidth, opacity, strokeLinecap...)

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.text(svg, { pos: [10,20], text: "Hello World" }) // a single text
geoviz.text(svg, { data: cities, text: "name" }) // labels where svg is the container
svg.text({ data: cities, text: "name" }) // labels where svg is the container
svg.plot({ type: "text", data: cities, text: "name" }) // labels where svg is the container
geoviz.text({ data: cities, text: "name" }) // labels with no container

tile()

The tile function allows to display raster tiles. To use this mark, you must use the projection d3.geoMercator() (or directly "mercator"). The function adds a layer to the SVG container and returns the layer identifier. If the container is not defined, then the layer is displayed directly.

Properties
NameTypeAttributesDefaultDescription
idstring<optional>

id of the layer

tileSizenumber<optional>
512

tile size

zoomDeltanumber<optional>
1

zoom offset

opacitynumber<optional>
1

tile opacity

urlfunction | string<optional>
"openstreetmap"

function like (x, y, z) => `https://something/${z}/${x}/${y}.png`. You can also enter the following strings directly: "openstreetmap", "opentopomap", "worldterrain", "worldimagery", "worldStreet", "worldphysical", "shadedrelief", "stamenterrain", "cartodbvoyager", "stamentoner","stamentonerbackground","stamentonerlite","stamenwatercolor","hillshade","worldocean","natgeo" or "worldterrain".

clipPathstring<optional>

clip-path. e.g. "url(#myclipid)"

svg_**<optional>

parameters of the svg container created if the layer is not called inside a container (e.g svg_width)

Example
// There are several ways to use this function
geoviz.tile() // no container
geoviz.tile(svg, {url: "worldterrain"}) // where svg is the container
svg.tile({url: "worldterrain"}) // where svg is the container
svg.plot({type: "tile", url: "worldterrain"}) // where svg is the container

tool/addonts()

The tool.addonts function allows add font to the document from an url.

Properties
NameTypeDescription
fontFamilystring

font family name

urlstring

tff- file url

tool/centroid()

The tool.centroid function calculate the centroid of all the geometries given in a GeoJSON FeatureCollection. It returns a GeoJSON FeatureCollection (points)

Properties
NameTypeAttributesDefaultDescription
dataobject

a GeoJSON FeatureCollection

options.largestboolean<optional>
true

place the centroid in the largest polygon.

options.latlongboolean<optional>
true

use true if input coordinates are in latitude ans longitude. Use false if the coordinates are already defined in the page plan

Example
let dots = geoviz.tool.centroid(world, { largest: true })

tool/choro()

The tool.choro function discretizes an array of numbers. It returns an object containing breaks, colors, the color of the missing value and a function.

Properties
NameTypeAttributesDefaultDescription
dataArray.<number>

an array of numerical values.

options.breaksArray.<number><optional>

class breaks including min and max

options.colorsstring | Array.<string><optional>
"Algae"

an array of colors or name of a color palette available in dicopal

options.reverseboolean<optional>
false

reverse colors

options.missingstring<optional>
"white"

a color for missings values

options.methodstring<optional>
"quantile"

classification method ('quantile', 'q6', 'equal', 'jenks', 'msd', 'geometric', 'headtail', 'pretty', 'arithmetic' or 'nestedmeans')

options.nbnumber<optional>
6

number of classes desired

options.precisionnumber<optional>
2

number of digits

options.minmaxboolean<optional>

to keep or delete min and max

options.knumber<optional>
1

number of standard deviations taken into account (msd method only)

options.middleboolean<optional>

to have the average as a class center (msd method only)

Example
geoviz.tool.choro(world.features.map((d) => d.properties.gdppc), {method: "equal", nb: 4})

tool/dissolve()

The tool.dissolve function aims to transform multi part features into single parts feature. It a GeoJSON FeatureCollection (without multi part features)

Properties
NameTypeAttributesDefaultDescription
dataobject

a GeoJSON FeatureCollection

options.areashareboolean<optional>
"_share"

name of the field containing the share area of the part

Example
let dots = geoviz.tool.dissolve(world)

tool/dodge()

The tool.dodge function use d3.forceSimulation to spread dots or circles of given in a GeoJSON FeatureCollection (points). It returns the coordinates in the page map. It can be used to create a dorling cartogram. The function returns a GeoJSON FeatureCollection (points) with coordinates in the page map.

Properties
NameTypeAttributesDefaultDescription
dataobject

a GeoJSON FeatureCollection

options.projectionfunction<optional>
d => d

d3 projection function

options.rnumber | string<optional>
10

a number or the name of a property containing numerical values.

options.knumber<optional>
50

radius of the largest circle (or corresponding to the value defined by fixmax)

options.fixmaxnumber<optional>
null

value matching the circle with radius k. Setting this value is useful for making maps comparable with each other

options.iterationnumber<optional>
200

number of iterations

options.gapnumber<optional>
0

space between points/circles

Example
let dots = geoviz.tool.dodge(world, { projection: d3.geoOrthographic(), r: "population", k: 40 })

tool/dotstogrid()

dotstogrid is a function to create a regular grid in the SVG plan count the number of dots inside

Properties
NameTypeAttributesDefaultDescription
svgobject

A geoviz SVG container

options.typestring<optional>
"hex"

type of grid ("hex", "square", "triangle","random")

options.stepnumber<optional>
50

grid resolution (in pixels)

options.datageoJSON<optional>

dots to count in the grid

options.varstring<optional>

field to sum

Example
geoviz.tool.dotstogrid(svg, {type:"triangle", step:30, data: dots, var: "mayvar"})

tool/featurecollection()

tool.featurecollection is a function to create a valid GeoJSON FeatureCollection, from geometries, features or coordinates. It returns a GeoJSON FeatureCollection.

Properties
NameTypeDescription
dataobject | Array

A GeoJSON FeatureCollection, an array of GeoJSON features, a single feature, an array of geometries, a single geometry or a array defining a bbox. You can also use an array of properties containing latitude and longitude coordinates. In this case, you need to specify the field names in the options.

options.latitudestring

name of field containing latitudes. You can also use lat

options.longitudestring

name of field containing longitudes. You can also use lon

options.coordinatesstring

name of field containing géographic coordinates. You can also use coords

options.geometrystring

name of field containing geoJSON geometries

tool/geotable()

geotable is a function to create an array on objects containing properties and geomeytries, froam a GeoJSON FeatureCollection. This makes it easy to sort, extract data, etc. tool.featurecollection(geotable, { geometry: "geometry" }) can be used to rebuild a valid geoJSON. The function returns an array of an array of FeatureCollections.

Properties
NameTypeDescription
dataobject

A GeoJSON FeatureCollection

options.geometrystring

name of field containing GEOJSON geometries

tool/height()

This function return a function to calculate radius of circles from data. It returns an object containing a radius function.

Properties
NameTypeAttributesDefaultDescription
dataArray.<number>

an array of numerical values.

options.fixmaxArray.<string><optional>

to fix the value corresponding to the circle with radius = k

options.kArray.<string><optional>
50

radius if the greater circle

tool/merge()

tool.merge is a function to join a geoJSON and a data file. It returns a GeoJSON FeatureCollection.

Properties
NameTypeAttributesDescription
geomArray

a GeoJSON FeatureCollection

geom_idstring

geom id

dataArray

array containg data

data_idstring

data id

idstring<optional>

id (if ids are the same in data and geometries)

tool/proj4d3()

proj4d3 is a function developped by Philippe Rivière to allow tu use proj4js projections with d3. It returns a d3js projection function. See https://observablehq.com/@fil/proj4js-d3

Properties
NameTypeDescription
proj4library

the proj4 lib that you have to load

proj4stringstring

a proj4 projection

Example
geoviz.tool.proj4d3(proj4, `+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs` )

tool/project()

The function tool.project use geoproject from d3-geo-projection to project a geoJSON. It returns a GeoJSON FeatureCollection with coordinates in the page map.

Properties
NameTypeDescription
dataobject

a GeoJSON FeatureCollection

options.projectionfunction

projection definition. See d3-geo & d3-geo-projection

Example
let newGeoJSON = geoviz.tool.project(world, { projection: d3.geoOrthographic()})

tool/radius()

The tool.radius function return a function to calculate radius of circles from data

Properties
NameTypeAttributesDefaultDescription
dataArray.<number>

an array of numerical values.

options.fixmaxArray.<string><optional>

to fix the value corresponding to the circle with radius = k

option.kArray.<string><optional>
50

radius if the greater circle

tool/random()

The tool.random function returns a random color among 20 predefined colors.

tool/replicate()

Data-driven features replication. This function can be used to create "dots cartograms". The function returns a GeoJSON FeatureCollection with overlapping features

Properties
NameTypeDescription
dataobject

a GeoJSON FeatureCollection

options.fieldstring

property name containing numeric data

options.targetvaluenumber

Feature target value

Example
let dots = geoviz.tool.replicate(world, { field: "population", targetvalue: 10000 })

tool/rewind()

The tool.rewind function allows to generate compliant Polygon and MultiPolygon geometries. Adapted from MapBox geojson-rewind code (https://github.com/mapbox/grojson-rewind) under ISC license

Properties
NameTypeAttributesDefaultDescription
dataobject

a GeoJSON FeatureCollection

options.outerboolean<optional>
false

rewind Rings Outer

options.mutateboolean<optional>
false

mutate the Input geoJSON

tool/ridge()

The tool.ridge function convert a regular grid (x,y,z) to a GeoJSON FeatureCollection (LineString). The aim is to draw a rideline map.

Properties
NameTypeAttributesDefaultDescription
gridarray

an array of object containig x,y,z values

options.xstring<optional>
"x"

field containg x values

options.ystring<optional>
"y"

field containg y values

options.zstring<optional>
"z"

field containg z values

options.knumber<optional>
100

height of highest peak

options.fixmaxnumber<optional>
null

a fixed value corresponding to the k

options.projectionboolean<optional>
d => d

projection

tool/symbols()

Display symbols available in geoviz

Properties
NameTypeAttributesDefaultDescription
options.widthnumber<optional>
800

width

Example
geoviz.tool.symbols({ width: 500 })

tool/typo()

The tool.typo function allows you to assign colors to qualitative data. It can be used to create typology maps. It returs an object containing types, colors, the color of the missing value and a function.

Properties
NameTypeAttributesDefaultDescription
dataArray.<number>

an array of numerical values.

options.colorsArray.<string><optional>
"Set3"

an array of colors or name of a color palette available in dicopal

options.missingstring<optional>
"white"

a color for missings values

Example
geoviz.tool.typo(world.features.map((d) => d.properties.region), {palette: "Pastel"})

tool/unproject()

The tool.unproject function allow to unproject geometries. It returns a GeoJSON FeatureCollection with wgs84 coordinates

Properties
NameTypeDescription
dataobject

a GeoJSON FeatureCollection

options.projectionfunction

projection definition. See d3-geo & d3-geo-projection

Example
let newGeoJSON = geoviz.tool.unproject(world, { projection: d3.geoOrthographic()})