Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/d3-geo

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-geo

TypeScript definitions for D3JS d3-geo module

  • 1.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
862K
decreased by-58.05%
Maintainers
1
Weekly downloads
 
Created

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

FAQs

Package last updated on 09 Mar 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc