Package smile.plot.vega
Class Projection
java.lang.Object
smile.plot.vega.Projection
The geographic projection, which will be applied to shape path for
"geoshape" marks and to latitude and "longitude" channels for other
marks.
A cartographic projection maps longitude and latitude pairs to x, y
coordinates. As with Vega, one can use projections in Vega-Lite to
lay out both geographic points (such as locations on a map) represented
by longitude and latitude coordinates, or to project geographic regions
(such as countries and states) represented using the GeoJSON format.
Projections are specified at the unit specification level, alongside
encoding. Geographic coordinate data can then be mapped to longitude
and latitude channels (and longitude2 and latitude2 for ranged marks).
-
Method Summary
Modifier and TypeMethodDescriptioncenter
(double longitude, double latitude) Sets the projection's center, a two-element array of longitude and latitude in degrees.clipAngle
(double angle) Sets the projection's clipping circle radius to the specified angle in degrees.clipExtent
(double x0, double y0, double x1, double y1) Sets the projection's viewport clip extent to the specified bounds in pixels.parallels
(double... parallels) For conic projections, sets the two standard parallels that define the map layout.pointRadius
(double radius) Sets the default radius (in pixels) to use when drawing GeoJSON Point and MultiPoint geometries.precision
(double threshold) Sets the threshold for the projection's adaptive resampling to the specified value in pixels.rotate
(double lambda, double phi, double gamma) Sets the projection's three-axis rotation to the specified angles by specifying the rotation angles in degrees about each spherical axis.scale
(double scale) Sets the projection's scale (zoom) factor, overriding automatic fitting.Returns the specification in pretty print.toString()
translate
(double tx, double ty) Sets the projection's translation offset.
-
Method Details
-
toString
-
toPrettyString
Returns the specification in pretty print.- Returns:
- the specification in pretty print.
-
center
Sets the projection's center, a two-element array of longitude and latitude in degrees.- Parameters:
longitude
- longitude in degrees.latitude
- latitude in degrees.- Returns:
- this object.
-
clipAngle
Sets the projection's clipping circle radius to the specified angle in degrees.- Parameters:
angle
- The clip angle in degrees.- Returns:
- this object.
-
clipExtent
Sets the projection's viewport clip extent to the specified bounds in pixels. The extent bounds are specified as [x0, y0] and [x1, y1].- Parameters:
x0
- the left of the viewport.y0
- the top of the viewport.x1
- the right of the viewport.y1
- the bottom of the viewport.- Returns:
- this object.
-
parallels
For conic projections, sets the two standard parallels that define the map layout.- Parameters:
parallels
- two standard parallels.- Returns:
- this object.
-
pointRadius
Sets the default radius (in pixels) to use when drawing GeoJSON Point and MultiPoint geometries.- Parameters:
radius
- the fill color.- Returns:
- this object.
-
precision
Sets the threshold for the projection's adaptive resampling to the specified value in pixels. This value corresponds to the Douglas–Peucker distance.- Parameters:
threshold
- the threshold.- Returns:
- this object.
-
rotate
Sets the projection's three-axis rotation to the specified angles by specifying the rotation angles in degrees about each spherical axis.- Parameters:
lambda
- correspond to yaw.phi
- correspond to pitch.gamma
- correspond to roll.- Returns:
- this object.
-
scale
Sets the projection's scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections.- Parameters:
scale
- the scale factor.- Returns:
- this object.
-
translate
Sets the projection's translation offset.- Parameters:
tx
- the offset in x-axis.ty
- the offset in y-axis.- Returns:
- this object.
-