Socket
Socket
Sign inDemoInstall

@types/d3-geo

Package Overview
Dependencies
1
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/d3-geo

TypeScript definitions for d3-geo


Version published
Weekly downloads
1.7M
decreased by-5.47%
Maintainers
1
Install size
71.9 kB
Created
Weekly downloads
 

Package description

What is @types/d3-geo?

The @types/d3-geo package contains TypeScript type definitions for d3-geo, a JavaScript library that provides geographical projections, transformations, and path generators. It enables developers to work with geographic data using D3.js, ensuring type safety and autocompletion in TypeScript projects.

What are @types/d3-geo's main functionalities?

Geographic Projections

This feature allows you to create various geographic projections to map spherical coordinates to a flat surface. The code sample demonstrates how to create an Albers projection and a path generator for rendering.

import * as d3 from 'd3-geo';

const projection = d3.geoAlbers();
const pathGenerator = d3.geoPath().projection(projection);
const pathData = pathGenerator({ type: 'Sphere' });

Spherical Shapes

This feature enables the creation of spherical shapes such as circles on the globe. The code sample shows how to create a geoCircle with a specified center and radius, and generate the path data for rendering.

import * as d3 from 'd3-geo';

const circle = d3.geoCircle().center([0, 0]).radius(90);
const circlePathData = d3.geoPath()(circle());

Geographic Transformations

This feature provides transformations such as rotations to manipulate geographic coordinates. The code sample illustrates how to rotate a point on the globe.

import * as d3 from 'd3-geo';

const rotate = d3.geoRotation([90, -45]);
const rotatedCoordinates = rotate([0, 0]);

GeoJSON Feature Rendering

This feature allows rendering of GeoJSON objects using D3's path generator. The code sample demonstrates how to generate path data for a GeoJSON feature.

import * as d3 from 'd3-geo';
import { Feature } from 'geojson';

const pathGenerator = d3.geoPath();
const feature: Feature = {
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [0, 0]
  }
};
const pathData = pathGenerator(feature);

Other packages similar to @types/d3-geo

Readme

Source

Installation

npm install --save @types/d3-geo

Summary

This package contains type definitions for d3-geo (https://github.com/d3/d3-geo/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-geo.

Additional Details

  • Last updated: Sun, 12 Nov 2023 19:07:04 GMT
  • Dependencies: @types/geojson

Credits

These definitions were written by Hugues Stefanski, Tom Wanzek, Alex Ford, Boris Yankov, and Nathan Bierema.

FAQs

Last updated on 12 Nov 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc