Class: PixelProjection
- Last UpdatedJun 30, 2025
- 3 minute read
PixelProjection
transforms pixel world coordinates at a certain scale
(zoom level) to geographical coordinates and vice versa. By default, it uses
the Mercator projection to transform geographic points into the 2d plane map
points, which are adjusted to the current scale.
Name | Type | Description |
---|---|---|
opt_projection |
H.geo.IProjection |
optional
An object representing the
projection to use, the default is spherical Mercator |
opt_sizeAtLevelZero |
number |
optional
A value indicating the size of a tile representation of the world in pixels at zoom level 0, the default is 256 |
Members
-
This property holds a value indicating the height of the world in pixels.
-
projection H.geo.IProjection non-null
-
This property indicates the geographical projection that underlies the given
PixelProjection
. -
This property holds a value indicating the width of the world in pixels.
-
This property holds the x-offset in the projection relative to the top-left corner of the screen.
-
This property holds the y-offset in the projection relative to the top-left corner of the screen.
Methods
-
geoToPixel (geoPoint, opt_out)H.math.IPoint
-
This method translates a point defines in terms of its geographic coordinates to pixel coordinates at the specified zoom level.
Name Type Description geoPoint
H.geo.IPoint An object containing the geographic coordinates
opt_out
H.math.IPoint optional An optional point to store the result
Returns:
Type Description H.math.IPoint An object representing the results of the the conversion to pixel coordinates -
This method retrieves the current zoom scale factor previously set by a call to
H.geo.PixelProjection#rescale
.Returns:
Type Description number A value indicating the zoom scale factor -
latLngToPixel (latitude, longitude, opt_out)H.math.Point
-
This method translates geographical coordinates (latitude, longitude) supplied by the caller into a point defined in terms of pixel coordinates. This method accepts longitudes outside of the normal longitude range.
Returns:
Type Description H.math.Point The results of the conversion as a point object containing x and y coordinates (in pixels) -
pixelToGeo (point, opt_out)H.geo.IPoint
-
This method translates a point defined in terms of its pixel coordinates to a location defined in geographic coordinates.
Name Type Description point
H.math.IPoint An object defining a location on the screen in terms of pixel coordinates
opt_out
H.geo.IPoint optional An optional point to store the result
Returns:
Type Description H.geo.IPoint An object representing the results of conversion to a geographic location -
pointToPixel (point)H.math.Point
-
This method method translates a map point to world pixel coordinates relative to current projection offset.
Name Type Description point
H.math.IPoint An object representing the map point to convert
Returns:
Type Description H.math.Point The result of the conversion as an object containing pixel coordinate -
This method updates the scale exponent for the pixel projection.
Name Type Description zoom
number A value indicating the zoom level
-
xyToGeo (x, y, opt_out)H.geo.Point
-
This method translates the x and y coordinates of a pixel to a geographic point.
Returns:
Type Description H.geo.Point An object representing the results of the conversion to a geographic location