Skip to content
mbostock edited this page Dec 22, 2012 · 11 revisions

WikiAPI ReferenceGeoGeo Streams

For fast transformations of geometry without temporary copies of geometry objects, D3 uses geometry streams. The main d3.geo.stream method converts a GeoJSON input object to a stream: a series of method calls on a stream listener. (Despite the name “stream”, these method calls are currently synchronous.) In addition, D3 provides several implementations of stream transformations that wrap listeners and transform the geometry. For example, the projection.stream interface transforms spherical coordinates to Cartesian coordinates, and d3.geo.path serializes geometry to either SVG or Canvas.

# d3.geo.stream(object, listener)

# listener.point(x, y)

# listener.lineStart()

# listener.lineEnd()

# listener.polygonStart()

# listener.polygonEnd()

Clone this wiki locally