pixelForCoordinate

open override fun pixelForCoordinate(coordinate: Point): ScreenCoordinate

Calculate a screen coordinate that corresponds to a geographical coordinate (i.e., longitude-latitude pair).

The screen coordinate is in MapOptions.size platform pixels relative to the top left of the map (not of the whole screen).

Map must be fully loaded for getting an altitude-compliant result if using 3D terrain.

If the screen coordinate is outside of the bounds of MapView the returned screen coordinate contains -1 for both coordinates.

This API isn't supported by Globe projection and will return a no-op result matching center of the screen. See com.mapbox.maps.extension.style.projection.generated.setProjection and com.mapbox.maps.extension.style.projection.generated.getProjection

Return

Returns a screen coordinate on the screen in MapOptions.size platform pixels. If the screen coordinate is outside of the bounds of MapView the returned screen coordinate contains -1 for both coordinates.

Parameters

coordinate

A geographical coordinate on the map to convert to a screen coordinate.