HERE Android SDK Developer's Guide

MapOverlay

The class MapOverlay is a member of com.here.android.mpa.mapping .

Class Summary

public class MapOverlay

extends java.lang.Object

The MapOverlay class can be used to display custom Android View-based content at a fixed location on the map.

[For complete information, see the section Class Details]

See also:

addMapOverlay(MapOverlay)

removeMapOverlay(MapOverlay)

Constructor Summary

Table 1. Constructors in MapOverlay
Constructors

MapOverlay (View view, GeoCoordinate coordinate)

Constructs new MapOverlay object.

Method Summary

Table 2. Methods in MapOverlay
Methods

public PointF getAnchorPoint ()

Returns the anchor point for this MapOverlay .

public GeoCoordinate getCoordinate ()

Returns the current map GeoCoordinate for this MapOverlay .

public View getView ()

Returns the View object that was passed to the constructor.

public MapOverlay setAnchorPoint (PointF anchor)

Sets an anchor point for this MapOverlay .

public MapOverlay setCoordinate (GeoCoordinate coordinate)

Sets a map GeoCoordinate for this MapOverlay .

Class Details

The MapOverlay class can be used to display custom Android View-based content at a fixed location on the map.

To use, create a MapOverlay with the custom view you wish to display and the position at which the view should be displayed. The overlay should be then added to the map with addMapOverlay(MapOverlay) method. The overlay will be automatically repositioned on the screen as the map moves.

See also:

addMapOverlay(MapOverlay)

removeMapOverlay(MapOverlay)

Constructor Details

MapOverlay (View view, GeoCoordinate coordinate)

Constructs new MapOverlay object.

Parameters:

  • view

    Custom view that will be displayed on the map.

  • coordinate

    Position at which the view should be displayed.

Throws:

  • NullPointerException

    If any of given parameters is null.

  • IllegalArgumentException

    If given coordinates are not valid.

Method Details

public PointF getAnchorPoint ()

Returns the anchor point for this MapOverlay .

The overlay is drawn with the specified pixel offset from its getCoordinate() position.

By default, there is no offset and the MapOverlay anchor is positioned in the center of the overlay.

Returns:

The current MapOverlay anchor point.

public GeoCoordinate getCoordinate ()

Returns the current map GeoCoordinate for this MapOverlay .

Returns:

The current GeoCoordinate location.

public View getView ()

Returns the View object that was passed to the constructor.

Returns:

View assigned to this MapOverlay

public MapOverlay setAnchorPoint (PointF anchor)

Sets an anchor point for this MapOverlay .

The overlay is drawn with the specified pixel offset from its getCoordinate() position. To clear an anchor set previously, pass a PointF to this method with an X-coordinate equal to half the width of the view and a Y-coordinate equal to half the height of the view.

By default, there is no offset and the MapOverlay anchor is positioned in the center of the overlay.

Parameters:

  • anchor

    A PointF relative to the top-left corner of the MapOverlay.

Returns:

The updated MapOverlay itself.

public MapOverlay setCoordinate (GeoCoordinate coordinate)

Sets a map GeoCoordinate for this MapOverlay .

Parameters:

  • coordinate

    Desired GeoCoordinate location for this overlay.

Returns:

The updated MapOverlay itself.

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.