
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@reuters-graphics/graphics-atlas-client
Advanced tools
[](https://badge.fury.io/js/%40reuters-graphics%2Fgraphics-atlas-client)
Global country metadata client, based on the International Organization for Standardization 3166 Country Codes. Includes translations for country and UN region names in German, French, Italian, Spanish, Portuguese, Japanese, Chinese and Persian/Fārsī.
Also includes a complete repository of topojson files for countries and UN regions and sub-regions.
$ yarn add @reuters-graphics/graphics-atlas-client
import AtlasMetadataClient from '@reuters-graphics/graphics-atlas-client';
const client = new AtlasMetadataClient();
client.regions;
// [
// {
// name: 'Asia',
// slug: 'asia',
// translations: {
// de: 'Asien',
// en: 'Asia',
// ...
// },
// subregions: [{}, {}],
// countries: [{}, {}],
// }
// ...
// ]
client.getRegion('Northern America'); // Region name or slug
client.getRegionSlug('Northern America');
// 'northern-america'
client.getRegionName('northern-america');
// 'Northern America'
client.getRegionByCountry('China'); // Country name, slug or code
// {
// name: 'Asia',
// slug: 'asia',
// translations: {},
// subregions: [{}, {}],
// countries: [{}, {}],
// }
client.subregions;
// [
// {
// name: 'Middle Africa',
// slug: 'middle-africa',
// region: {},
// countries: [{}, {}],
// }
// ...
// ]
client.getSubregionSlug('Middle Africa');
// 'middle-africa'
client.getSubregionName('middle-africa');
// 'Middle Africa'
client.getSubregionByCountry('DE');
// {
// name: 'Western Europe',
// slug: 'western-europe',
// region: {},
// countries: [{}, {}],
// }
client.countries;
// [
// {
// name: 'United Kingdom',
// slug: 'united-kingdom',
// isoAlpha2: 'GB',
// isoAlpha3: 'GBR',
// isoNumeric: '826',
// translations: {
// de: 'Vereinigtes Königreich',
// en: 'United Kingdom',
// ...
// },
// abbreviations: {
// en: 'U.K.',
// },
// dataProfile: {
// population: {},
// },
// region: {},
// subregion: {},
// }
// ...
// ]
client.getCountry('GB') // Country name, slug or code
// {
// name: 'United Kingdom',
// slug: 'united-kingdom',
// isoAlpha2: 'GB',
// isoAlpha3: 'GBR',
// isoNumeric: '826',
// translations: {
// de: 'Vereinigtes Königreich',
// en: 'United Kingdom',
// ...
// },
// abbreviations: {
// en: 'U.K.',
// },
// region: {},
// subregion: {},
// }
client.getCountriesByRegion('Asia');
client.getCountriesBySubregion('Western Europe');
client.getCountrySlug('Ireland'); // Country name or code
// 'ireland'
client.getCountryName('IRL'); // Country slug or code
// 'Ireland'
Note: Metadata does not include countries which are not assigned a code by the International Organization for Standardization. These include:
// Use a country's ISO alpha 2 code
// Germany
import topology from '@reuters-graphics/graphics-atlas-client/topojson/DE.json';
// Use a UN region or sub-region's slug to get a collection of countries
// Africa
import topology from '@reuters-graphics/graphics-atlas-client/topojson/africa.json';
// Central America
import topology from '@reuters-graphics/graphics-atlas-client/topojson/central-america.json';
// World includes all countries and disputed boundaries
import topology from '@reuters-graphics/graphics-atlas-client/topojson/world.json';
import AtlasMetadataClient from '@reuters-graphics/graphics-atlas-client';
const client = new AtlasMetadataClient();
// Use a country's name, slug or ISO code
client.fetchCountryTopojson('germany')
.then((topojson) => { ... });
// Use a UN region or sub-region's name or slug to get a collection of countries
client.fetchRegionTopojson('Africa')
.then((topojson) => { ... });
// Get the world topojson
client.fetchGlobalTopojson()
.then((topojson) => { ... });
fetch('https://cdn.jsdelivr.net/npm/@reuters-graphics/graphics-atlas-client@latest/topojson/world.json')
.then(res => res.json())
.then((topology) => {
console.log(topology);
});
$ yarn build:metadata
$ yarn build
$ yarn build:maps
$ yarn build:maps:custom
Centroids for each country are automatically calculated and added to the properties of each country's topojson. You can override the default calculation by adding a custom centroid to the data/custom_centroids.csv
file and rebuilding the maps.
FAQs
[](https://badge.fury.io/js/%40reuters-graphics%2Fgraphics-atlas-client)
The npm package @reuters-graphics/graphics-atlas-client receives a total of 6 weekly downloads. As such, @reuters-graphics/graphics-atlas-client popularity was classified as not popular.
We found that @reuters-graphics/graphics-atlas-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.