Maps API for JavaScript Developer's Guide

H.geo.PixelProjection

Class Summary

PixelProjection is used to transform pixel world coordinates at certain scale (zoom level) to geographical coordinates and vice-versa. By default it uses mercator geo projection to transform geo points into the 2d plane map point which are adjusted to current scale.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

projection : {H.geo.IProjection}

Geographical projection that backs given PixelProjection.

x : {number}

X-offset in projection relative to top left corner.

y : {number}

Y-offset in projection relative to top left corner.

w : {number}

Width of the world in pixels

h : {number}

Height of the world in pixels

Method Summary

Table 2. Methods
Methods

rescale (zoom)

This method updates scale exponent for the pixel projection.

getZoomScale () : {number}

This method returns current zoom scale factor previously set by H.geo.PixelProjection#rescale function.

geoToPixel (geoPoint, opt_out) : {H.math.IPoint}

This method translates geo point to pixel coordinates at given zoom level.

pixelToGeo (point, opt_out) : {H.geo.IPoint}

This method translates a pixel's point to the according geo point.

xyToGeo (x, y, opt_out) : {H.geo.Point}

This method translates pixel's x and y coordinates to the according geo point.

latLngToPixel (latitude, longitude, opt_out) : {H.math.Point}

This method translates geographical coordinates (latitude, longitude) supplied by the caller. This method accepts longitudes outside of the normal longitude range. into a point defined in terms of pixel coordinates.

pointToPixel (point) : {H.math.Point}

Method translates provided map point to world pixel coordinates relative to current projection offset.

Class Description

PixelProjection is used to transform pixel world coordinates at certain scale (zoom level) to geographical coordinates and vice-versa. By default it uses mercator geo projection to transform geo points into the 2d plane map point which are adjusted to current scale.

Constructor Details

H.geo.PixelProjection(opt_projection, opt_sizeAtLevelZero)

Parameters:
 
opt_projection:
{H.geo.IProjection=} [optional]
 
default is spherical mercator H.geo.mercator
opt_sizeAtLevelZero:
{number=} [optional]
 
world size in pixels at zoom level 0, default is 256

Property Details

projection: {H.geo.IProjection}

Geographical projection that backs given PixelProjection.

x: {number}

X-offset in projection relative to top left corner.

y: {number}

Y-offset in projection relative to top left corner.

w: {number}

Width of the world in pixels

h: {number}

Height of the world in pixels

Method Details

rescale (zoom)

This method updates scale exponent for the pixel projection.

Parameters:
 
zoom:
{number}
 

getZoomScale () : {number}

This method returns current zoom scale factor previously set by H.geo.PixelProjection#rescale function.

Returns:
 
{number}

geoToPixel (geoPoint, opt_out) : {H.math.IPoint}

This method translates geo point to pixel coordinates at given zoom level.

Parameters:
 
geoPoint:
{H.geo.IPoint}
 
opt_out:
{H.math.IPoint=} [optional]
 
an optional point to store the result
Returns:
 
{H.math.IPoint}

pixelToGeo (point, opt_out) : {H.geo.IPoint}

This method translates a pixel's point to the according geo point.

Parameters:
 
point:
{H.math.IPoint}
 
opt_out:
{H.geo.IPoint=} [optional]
 
an optional point to store the result
Returns:
 
{H.geo.IPoint}

xyToGeo (x, y, opt_out) : {H.geo.Point}

This method translates pixel's x and y coordinates to the according geo point.

Parameters:
 
x:
{number}
 
y:
{number}
 
opt_out:
{H.geo.Point=} [optional]
 
an optional point to store the result
Returns:
 
{H.geo.Point}

latLngToPixel (latitude, longitude, opt_out) : {H.math.Point}

This method translates geographical coordinates (latitude, longitude) supplied by the caller. This method accepts longitudes outside of the normal longitude range. into a point defined in terms of pixel coordinates.

Parameters:
 
latitude:
{number}
 
The latitude to translate
longitude:
{number}
 
The longitude to translate
opt_out:
{H.math.IPoint=} [optional]
 
an optional point to store the result
Returns:
 
{H.math.Point}
A point object containing x and y coordinates (in pixels)

pointToPixel (point) : {H.math.Point}

Method translates provided map point to world pixel coordinates relative to current projection offset.

Parameters:
 
point:
{H.math.IPoint}
 
Returns:
 
{H.math.Point}
pixel coordinate

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.