Returns a new array [x, y] (typically in pixels) representing the projected point of the given point. The point must be specified as a two-element array [longitude, latitude] in degrees. May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection.
For many more projections, see d3-geo-projection. You can implement custom projections using d3.geoProjection or d3.geoProjectionMutator.
A point specified as a two-dimensional array [longitude, latitude] in degrees.
Returns the current center of the projection, which defaults to ⟨0°,0°⟩.
Sets the projection’s center to the specified center, a two-element array of longitude and latitude in degrees and returns the projection. The default is ⟨0°,0°⟩.
A point specified as a two-dimensional array [longitude, latitude] in degrees.
Returns the current clip angle which defaults to null.
null switches to antimeridian cutting rather than small-circle clipping.
Switches to antimeridian cutting rather than small-circle clipping.
Set to null to switch to antimeridian cutting.
Sets the projection’s clipping circle radius to the specified angle in degrees and returns the projection. Small-circle clipping is independent of viewport clipping via projection.clipExtent.
Angle in degrees.
Returns the current viewport clip extent which defaults to null.
Sets the clip extent to null and returns the projection. With a clip extent of null, no viewport clipping is performed.
Viewport clipping is independent of small-circle clipping via projection.clipAngle.
Set to null to disable viewport clipping.
Sets the projection’s viewport clip extent to the specified bounds in pixels and returns the projection. The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom.
Viewport clipping is independent of small-circle clipping via projection.clipAngle.
The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom.
Sets the projection’s scale and translate to fit the specified geographic feature in the center of the given extent. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
A geographic feature supported by d3-geo (An extension of GeoJSON feature).
Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON).
Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0]. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The size of the extent, specified as an array [width, height].
A geographic feature supported by d3-geo (An extension of GeoJSON feature).
Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of an extent with the given size and top-left corner of [0, 0]. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The size of the extent, specified as an array [width, height].
A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of an extent with the given size and top-left corner of [0, 0]. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The size of the extent, specified as an array [width, height].
A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON).
Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of an extent with the given size and top-left corner of [0, 0]. Returns the projection.
Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
The size of the extent, specified as an array [width, height].
A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point. May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection.
The projected point, specified as a two-element array [x, y] (typically in pixels).
Returns the projection’s current resampling precision which defaults to square root of 0.5. This value corresponds to the Douglas–Peucker distance.
Sets the threshold for the projection’s adaptive resampling to the specified value in pixels and returns the projection. This value corresponds to the Douglas–Peucker distance.
A numeric value in pixels to use as the threshold for the projection’s adaptive resampling.
Returns the current rotation [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.) which defaults [0, 0, 0].
Sets the projection’s three-axis rotation to the specified angles, which must be a two- or three-element array of numbers.
A two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.) If the rotation angle gamma is omitted, it defaults to 0.
Returns the current scale factor; the default scale is projection-specific.
The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections.
Sets the projection’s scale factor to the specified value and returns the projection. The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections.
Scale factor to be used for the projection; the default scale is projection-specific.
Returns a projection stream for the specified output stream. Any input geometry is projected before being streamed to the output stream. A typical projection involves several geometry transformations: the input geometry is first converted to radians, rotated on three axes, clipped to the small circle or cut along the antimeridian, and lastly projected to the plane with adaptive resampling, scale and translation.
An input stream
Returns the current translation offset which defaults to [480, 250] and places ⟨0°,0°⟩ at the center of a 960×500 area. The translation offset determines the pixel coordinates of the projection’s center.
Sets the projection’s translation offset to the specified two-element array [tx, ty] and returns the projection. The translation offset determines the pixel coordinates of the projection’s center. The default translation offset places ⟨0°,0°⟩ at the center of a 960×500 area.
A two-element array [tx, ty] specifying the translation offset. The default translation offset of defaults to [480, 250] places ⟨0°,0°⟩ at the center of a 960×500 area.
Generated using TypeDoc
A Geographic Projection to transform spherical polygonal geometry to planar polygonal geometry. D3 provides implementations of several classes of standard projections:
For many more projections, see d3-geo-projection. You can implement custom projections using d3.geoProjection or d3.geoProjectionMutator.