here-android-sdk-examples icon indicating copy to clipboard operation
here-android-sdk-examples copied to clipboard

Android How to get metersPerPointAtZoomLevel

Open lucifer222 opened this issue 3 years ago • 2 comments

/**

  • Get the screen-space to world-space conversion factor at a specified zoom level.
  • @param zoomLevel The zoom level at which to retrieve the conversion factor.
  • @return The conversion factor in meters per point.
  • @note The conversion factor is based on a straight-line distance between two points;
  • that is, it does not take into account the curvature of the Earth. */
  • (float)metersPerPointAtZoomLevel:(float)zoomLevel;

This method is in the ios sdk.

Hi @NazarKacharaba , How to calculate this value in the android?

lucifer222 avatar Jul 01 '21 11:07 lucifer222

Use following Map API to calculate meters per pixel value:

/**
 * Returns a map scale value based on the specified zoom level. Scale units are in physical geo
 * centimeters per screen inch.
 *
 * @param level
 *            The zoom level to be translated to a map scale.
 * @return Scale value for the passed {@code level}. Units are in geo centimeters per screen
 *         inch
 */
@HybridPlus
public double getScaleFromZoomLevel(double level) {
    return m_pimpl.getScaleFromZoomLevel(level);
}

NazarKacharaba avatar Jul 07 '21 09:07 NazarKacharaba

Use following Map API to calculate meters per pixel value:

/**
 * Returns a map scale value based on the specified zoom level. Scale units are in physical geo
 * centimeters per screen inch.
 *
 * @param level
 *            The zoom level to be translated to a map scale.
 * @return Scale value for the passed {@code level}. Units are in geo centimeters per screen
 *         inch
 */
@HybridPlus
public double getScaleFromZoomLevel(double level) {
    return m_pimpl.getScaleFromZoomLevel(level);
}

Thank you, @NazarKacharaba. But how to calculate? Can you help to provide it in detail?

lucifer222 avatar Jul 10 '21 10:07 lucifer222