0.0.9 • Published 3 months ago

@metamorfosilab/meta-map v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

MetaMap

MetaMap Logo

MetaMap is a JavaScript library for creating interactive maps of countries with markers. It is built using D3.js and provides a flexible and customizable way to visualize geographic data.

Installation

You can install MetaMap via pnpm:

pnpm install @metamorfosilab/meta-map

Configuration Options

KeyTypeDefaultDescription
mapPathstring*RequiredPath to topographic map data.
maxZoomnumber20Maximum zoom level for the map.
countryStrokeWidthstring"0.25px"Stroke width for country borders.
countryFillColorstring | object"#cccccc"Color of countries. Can be a string or a gradient object.
countryStrokeColorstring"#ffffff"Color of country borders.
accentFillColorstring | object"red"Color of selected countries. Can be a string or a gradient object.
accentStrokeColorstring"#ffffff"Color of borders for selected countries.
groupFillColorstring"yellow"Fill color for country groups.
widthnumber | string900Width of the map.
heightnumber | string600Height of the map.
markersarray: object[]Array of markers with longitude, latitude, and optional properties.
markerStyleobject{ color: "blue", img: null, width: 20, height: 20 }Style configuration for markers, including color, size, and image.
countryGroupsarray: objectnullArray of country groups.
selectedCountriesarray: string[]Array of selected countries.
isZoomablebooleanfalseEnable map zooming.
zoomedCountriesarray: string[]Array of countries to zoom in after initialization.
onobject{}Object with event listeners.

Gradient Fill Color

To pass a gradient color, use an object with the following fields:

  • rotate: Gradient rotation angle.
  • startColor: Start color of the gradient (extended settings possible).
  • endColor: End color of the gradient (extended settings possible).

Example:

// ...config
countryFillColor: {
rotate: 65,
startColor: { color: "#061654", offset: "0%" },
endColor: { color: "#04143A", offset: "100%" },
},
accentFillColor: {
rotate: 65,
startColor: { color: "#04143A", offset: "20%" },
endColor: { color: "#E4B700", offset: "60%" },
},

Country Groups

  • id: Unique identifier for the group.
  • countryList: Array of country IDs in the group.

Methods

  • map.selectCountry(id): Highlight a country on the map.
  • map.selectCountryList(idList): Highlight an array of countries on the map.
  • map.unselectCountry(id): Remove highlighting from a country.
  • map.unselectAllCountries(): Remove highlighting from all countries.
  • map.zoomCountries(idList): Zoom the map to the specified countries.
  • map.moveToCountries(idList): Move the map to
0.0.9

3 months ago

0.0.7

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.6

4 months ago

0.0.1

4 months ago