-
Notifications
You must be signed in to change notification settings - Fork 0
Geo Projections
Wiki ▸ API Reference ▸ Geo ▸ Geo Projections
The spherical Mercator projection is commonly used by tiled mapping libraries (such as OpenLayers and Leaflet). It is conformal; however, it introduces severe area distortion at world scale and thus is not recommended for choropleths.
# d3.geo.mercator()
Construct a new spherical Mercator projection with the default scale (500) and translate ([480, 250]). The default Mercator projection is appropriate for displaying the entire world in a 960×500 area.
# mercator(location)
The forward projection: returns a two-element array [x, y] given the input [longitude, latitude].
# mercator.invert(point)
The inverse projection: returns a two-element array [longitude, latitude] given the input [x, y].
# mercator.scale([scale])
Get or set the projection’s scale factor. If scale is specified, sets the projection’s scale factor to the specified value and returns the projection. If scale is not specified, returns the current scale factor which defaults to 500. The scale factor corresponds linearly to the distance between projected points.
# mercator.translate([offset])
Get or set the projection's translation offset. If offset is specified, sets the projection’s translation offset to the specified two-element array [x, y] and returns the projection. If offset is not specified, returns the current translation offset which defaults to [480, 250]. The translation offset determines the pixel coordinates of the origin ([0, 0] in longitude and latitude). The default value is designed to place null island at the center of a 960×500 area.
The Albers equal-area projection is highly recommended for choropleths as it does not preserves the relative areas of geographic features. However, you must determine appropriate parallels.
# d3.geo.albers()
Construct a new Albers equal-area conic projection.
# albers(position)
Project the specified position.
# albers.origin([origin])
Get or set the projection's origin.
# albers.parallels([parallels])
Get or set the projection's two standard parallels.
# albers.scale([scale])
Get or set the projection's scale factor.
# albers.translate([offset])
Get or set the projection's translate offset.
# d3.geo.albersUsa()
Construct a new composite Albers projection for the United States.
# albersUsa(position)
Project the specified position.
# albersUsa.scale([scale])
Get or set the projection's scale factor.
# albersUsa.translate([offset])
Get or set the projection's translate offset.
# d3.geo.azimuthal()
Construct a new Azimuthal (orthographic or stereographic) projection.
# azimuthal(position)
Project the specified position.
# azimuthal.mode([mode])
Get or set the projection's mode (orthographic or stereographic).
# azimuthal.origin([origin])
Get or set the projection's origin.
# azimuthal.scale([scale])
Get or set the projection's scale factor.
# azimuthal.translate([offset])
Get or set the projection's translate offset.