Powered by Zoomin Software. For more details please contactZoomin

HERE Maps API for JavaScript - API Reference

Product category
Technology
Doc type
Version
Product lifecycle
This publication

HERE Maps API for JavaScript - API Reference: Class: PixelProjection

Table of Contents

Class: PixelProjection

H.geo.PixelProjection

new H.geo.PixelProjection (opt_projection, opt_sizeAtLevelZero)

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 H.geo.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

h number

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.

w number

This property holds a value indicating the width of the world in pixels.

x number

This property holds the x-offset in the projection relative to the top-left corner of the screen.

y number

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

getZoomScale ()number

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

rescale (zoom)

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
Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert