Package-level declarations

Types

Link copied to clipboard
class GeoEngine
Link copied to clipboard
open class GridState(val zoomLevel: Int = MAX_ZOOM_LEVEL, val gridSize: Int = GRID_SIZE, passedInTreeContext: CloseableCoroutineDispatcher? = null)
Link copied to clipboard
data class PositionedString(val text: String, val location: LngLatAlt? = null, val earcon: String? = null, val type: AudioType = AudioType.STANDARD, val heading: Double? = null)
Link copied to clipboard
open class ProtomapsGridState(val zoomLevel: Int = MAX_ZOOM_LEVEL, val gridSize: Int = GRID_SIZE, passedInTreeContext: CloseableCoroutineDispatcher? = null) : GridState
Link copied to clipboard
Link copied to clipboard
data class StreetPreviewChoice(val heading: Double, val name: String, val way: Way)
Link copied to clipboard
data class StreetPreviewState(val enabled: StreetPreviewEnabled = StreetPreviewEnabled.OFF, val choices: List<StreetPreviewChoice> = emptyList())
Link copied to clipboard
data class TextForFeature(val text: String = "", val generic: Boolean = false)
Link copied to clipboard
enum TreeId : Enum<TreeId>
Link copied to clipboard
class UserGeometry(val location: LngLatAlt = LngLatAlt(), var phoneHeading: Double? = null, var fovDistance: Double = 50.0, val speed: Double = 0.0, val mapMatchedWay: Way? = null, val mapMatchedLocation: PointAndDistanceAndHeading? = null, val currentBeacon: LngLatAlt? = null, val ruler: Ruler = CheapRuler(location.latitude), val timestampMilliseconds: Long = 0, headingMode: UserGeometry.HeadingMode = HeadingMode.CourseAuto, travelHeading: Double? = null, headHeading: Double? = null, val inStreetPreview: Boolean = false)

UserGeometry contains all of the data relating to the location and motion of the user. It's aim is to reduces the number of arguments to many of the API calls and to concentrate some of the logic around heading choice.

Properties

Link copied to clipboard
const val GRID_SIZE: Int = 2
Link copied to clipboard
const val MAX_ZOOM_LEVEL: Int = 15

The zoom level and grid size were constant when using soundscape-backend at 16 and 3 respectively. With protobuf tiles the tile grid for walking around will be 15 and 2, but we can also have a lower zoom level to allow us to give better context when we're travelling by faster means of transport e.g. inter city train. The lower zoom levels mean that we can search for the nearest village or town instead of just the nearest street or road.

Link copied to clipboard

The default tile server is the one out in the cloud where the tile JSON is at: https://server/protomaps.json

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun formatDistance(distance: Double, localizedContext: Context): String

We're going to round metric as documented for iOS: For metric units, we round all distances less than 1000 meters to the nearest 5 meters and all distances over 1000 meters to the nearest 50 meters.

Link copied to clipboard
fun getTextForFeature(localizedContext: Context?, feature: Feature): TextForFeature

getNameForFeature returns text describing the feature for callouts. Usually it returns a name or if it doesn't have one then a localized description of the type of feature it is e.g. bike parking, or style. Some types of Feature have more info e.g. bus stops and railway stations

Link copied to clipboard
fun localReverseGeocode(location: LngLatAlt, gridState: GridState, settlementGrid: GridState, localizedContext: Context?): LocationDescription?
Link copied to clipboard
fun reverseGeocode(userGeometry: UserGeometry, gridState: GridState, settlementGrid: GridState, localizedContext: Context?): PositionedString?

Reverse geocodes a location into 1 of 4 possible states