Renders the given object, which may be any GeoJSON feature or geometry object:
The type Sphere is also supported, which is useful for rendering the outline of the globe; a sphere has no coordinates.
Any additional arguments are passed along to the pointRadius accessor.
If the rendering context is null, the function returns an SVG Path string, otherwise the function renders to the current context.
Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interation (e.g., click or mouseover). Canvas rendering (see path.context) is typically faster than SVG, but requires more effort to implement styling and interaction.
The first generic type of the GeoPath generator used, must correspond to the "this" context bound to the function upon invocation.
An object to be rendered.
Returns the projected planar area (typically in square pixels) for the specified GeoJSON object. Point, MultiPoint, LineString and MultiLineString features have zero area. For Polygon and MultiPolygon features, this method first computes the area of the exterior ring, and then subtracts the area of any interior holes. This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent.
Returns the projected planar bounding box (typically in pixels) for the specified GeoJSON object. The bounding box is represented by a two-dimensional array: [[x₀, y₀], [x₁, y₁]], where x₀ is the minimum x-coordinate, y₀ is the minimum y-coordinate, x₁ is maximum x-coordinate, and y₁ is the maximum y-coordinate.
This is handy for, say, zooming in to a particular feature. (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent.
Returns the projected planar centroid (typically in pixels) for the specified GeoJSON object. This is handy for, say, labeling state or county boundaries, or displaying a symbol map. For example, a noncontiguous cartogram might scale each state around its centroid. This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent.
Returns the current render context which defaults to null.
Use the generic to cast the return type of the rendering context, if it is known for a specific application.
Set the current rendering context to null and return the path generator. The path generator will return an SVG path string;
Null to remove the current rendering context, if any.
Set the current rendering context and return the path generator. The path generator will render to the specified context.
Rendering context to be used by the path generator. The context must at least implement GeoContext, a subset of the CanvasRenderingContext2D API.
Returns the current radius or radius accessor used to determine the radius for the display of Point and MultiPoint features. The default is a constant radius of 4.5.
Sets the radius used to display Point and MultiPoint features to the specified number and return the geo path generator.
Fixed radius value.
Sets the radius used to display Point and MultiPoint features to use the specified radius accessor function.
While the radius is commonly specified as a number constant, it may also be specified as a function which is computed per feature, being passed the any arguments passed to the path generator. For example, if your GeoJSON data has additional properties, you might access those properties inside the radius function to vary the point size; alternatively, you could d3.symbol and a projection for greater flexibility.
A value accessor function for the radius which is evaluated for each path to be rendered. The value accessor function is invoked within the "this" context in which the path generator is used. It is passed the object to be rendered, and any additional arguments which have been passed into the call to the render function of the path generator.
Get the current projection. The generic parameter can be used to cast the result to the correct, known type of the projection, e.g. GeoProjection or GeoConicProjection. Otherwise, the return type defaults to the minimum type requirement for a projection which can be passed into a GeoPath.
Use the generic to cast the return type of the projection, if it is known for a specific application.
Set the projection to the identity projection.
Use null to set the identity projection.
Set the current projection to be used with the geo path generator.
The given projection is typically one of D3’s built-in geographic projections; however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. See D3’s transforms for more examples of arbitrary geometric transformations.
A projection.
Set the projection to be used with the geo path generator to a custom projection. Custom projections must minimally contain a stream method.
The given projection is typically one of D3’s built-in geographic projections; however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. See D3’s transforms for more examples of arbitrary geometric transformations.
A wrapper object exposing, at a minimum a "stream" method to be used for custom projections.
Generated using TypeDoc
A Geo Path generator
The first generic corresponds to the "this"-context within which the geo path generator will be invoked. This could be e.g. the DOMElement bound to "this" when using selection.attr("d", ...) with the path generator.
The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering.