### Package Installation and Uninstallation
Source: https://docs.2gis.com/en/ios/sdk/reference/10.0/INavigationView
Methods for starting the installation/update or removal of a package.
```APIDOC
## install()
### Description
Start the package installation or update.
### Method
`install()`
```
```APIDOC
## uninstall()
### Description
Start the package removal.
### Method
`uninstall()`
```
--------------------------------
### Check for Car Start Instruction
Source: https://docs.2gis.com/en/android/sdk/reference/stable/ru.dgis.sdk.routing.RoadMacroGraph
Verifies if the instruction indicates the start of a car route. Use 'asCarStart' to get the specific instruction details.
```kotlin
val isCarStart: Boolean
```
--------------------------------
### Install Package
Source: https://docs.2gis.com/en/ios/sdk/reference/10.0/class
Initiates the installation or update process for a package.
```APIDOC
## install()
### Description
Start the package installation or update.
### Signature
public func install()
```
--------------------------------
### Start Navigation (Default)
Source: https://docs.2gis.com/en/ios/sdk/reference/10.0/class
Starts the route guidance with default options.
```APIDOC
## start() throws
### Description
Starts the navigator operation.
```
--------------------------------
### Package Installation
Source: https://docs.2gis.com/en/android/sdk/reference/10.3/class
Initiates a package installation or update operation.
```APIDOC
## install()
### Description
Initiates a package installation or update operation.
### Method
```kotlin
fun install(): Unit
```
```
--------------------------------
### Start Navigation
Source: https://docs.2gis.com/en/ios/sdk/reference/10.3/class
Starts the route guidance. This method can throw an error if the route cannot be built.
```swift
public func start() throws
```
--------------------------------
### Start Route Guidance
Source: https://docs.2gis.com/en/android/sdk/reference/7.0/class
Starts route guidance. Optionally takes a traffic route to start tracking, otherwise builds a route from the current location.
```kotlin
fun start(routeBuildOptions: RouteBuildOptions, trafficRoute: TrafficRoute? = null): Unit
```
--------------------------------
### Install or Update Package
Source: https://docs.2gis.com/en/ios/sdk/reference/12.0/INavigationView
Initiates the installation or update process for a package.
```APIDOC
## install()
### Description
Start the package installation or update.
### Method
`func install()`
```
--------------------------------
### point
Source: https://docs.2gis.com/en/android/sdk/reference/10.1/class
Gets the starting point of the segment for a PublicTransportTransferRouteLongEntry.
```APIDOC
## point
### Description
Gets the starting point of the segment.
### Returns
- **RoutePoint** - The starting point of the segment.
```
--------------------------------
### Initialize SDK with Key from File Path
Source: https://docs.2gis.com/en/ios/sdk/start
This method initializes the SDK using a license key file located at an absolute path. It retrieves the path from the main bundle.
```swift
// Getting the key file
let key = Bundle.main.path(forResource: "dgissdk", ofType: "key").map {
KeySource.fromFile(KeyFromFile(path: $0))
}
// Creating the Container
let sdk = DGis.Container(keySource: key)
```
--------------------------------
### Start Navigation
Source: https://docs.2gis.com/en/android/sdk/reference/10.0/class
Starts route guidance. Can optionally take a traffic route to navigate.
```kotlin
fun start(): Unit
```
```kotlin
fun start(routeBuildOptions: RouteBuildOptions, trafficRoute: TrafficRoute? = null): Unit
```
--------------------------------
### Install or Update Package
Source: https://docs.2gis.com/en/ios/sdk/reference/10.0/INavigationView
Initiates the installation or update process for a package. This method is asynchronous and may take time to complete.
```swift
public func install()
```
--------------------------------
### point
Source: https://docs.2gis.com/en/android/sdk/reference/7.0/class
Gets the starting point of the route segment.
```APIDOC
## point
### Properties
#### val point
RoutePoint
```
--------------------------------
### DefaultInstallFallback
Source: https://docs.2gis.com/en/ios/sdk/reference/13.4/class
Factory for creating predefined strategies for package installation or update errors.
```APIDOC
## DefaultInstallFallback
Factory for creating predefined strategies for package installation or update errors (InstallFallback).
Extends: Hashable
### Equality
```swift
public static func == (lhs: DefaultInstallFallback, rhs: DefaultInstallFallback) -> Bool
```
Returns a Boolean value indicating whether two values are equal.
### Hashing
```swift
public func hash(into hasher: inout Hasher)
```
Hashes the essential components of this value by passing them into the specified hasher.
Parameters:
#### hasher
Hasher
The hasher to use when combining the components of the instance.
### noOperation
```swift
public static func noOperation() -> InstallFallback
```
Creates a `fallback` that performs no operations (no-op).
Returns:
InstallFallback
### retryOnError
```swift
public static func retryOnError(
retryCount: UInt64
) -> InstallFallback
```
Creates a `fallback` that repeatedly calls the `install()` method in case of a package download error.
Parameters:
#### retryCount
UInt64
Limit of repeated calls of the `install()` method before stopping execution.
Returns:
InstallFallback
```
--------------------------------
### Check for Pedestrian Start Instruction
Source: https://docs.2gis.com/en/android/sdk/reference/stable/ru.dgis.sdk.routing.RoadMacroGraph
Checks if the instruction represents the start of a pedestrian route. Use 'asPedestrianStart' to get the specific instruction.
```kotlin
val isPedestrianStart: Boolean
```
--------------------------------
### StringRouteLongEntry.point
Source: https://docs.2gis.com/en/android/sdk/reference/10.4/class
Gets the starting point of the route segment for this StringRouteLongEntry.
```APIDOC
## point
### Description
Gets the starting point of the route segment.
### Returns
- RoutePoint - The starting point.
```
--------------------------------
### Initialize SDK with Advanced Options
Source: https://docs.2gis.com/en/ios/sdk/start
Initialize the SDK with a license key and configure optional settings for logging, HTTP client, and personal data collection.
```swift
// Logging settings
let logOptions = LogOptions(systemLevel: .info)
// HTTP client settings
let httpOptions = HttpOptions.init()
// Consent to personal data processing
let personalDataCollectionOptions = PersonalDataCollectionOptions(personalDataCollectionConsent: .granted)
// Creating the Container
let sdk = DGis.Container(
keySource: key,
logOptions: logOptions,
httpOptions: httpOptions,
personalDataCollectionOptions: personalDataCollectionOptions
)
```
--------------------------------
### RoutePoint.distance Property
Source: https://docs.2gis.com/en/android/sdk/reference/10.2/class
Gets the distance of the RoutePoint from the start of the route.
```APIDOC
## RoutePoint.distance
### Description
Represents the distance of this point from the beginning of the route.
### Properties
#### distance
- **distance** (RouteDistance) - The distance value.
```
--------------------------------
### Initialize SDK with Application Context
Source: https://docs.2gis.com/en/android/sdk/start
Call the `initialize()` method with the application context to set up the SDK. Ensure the `dgissdk.key` file is in your application's assets.
```kotlin
class Application : Application() {
lateinit var sdkContext: Context
override fun onCreate() {
super.onCreate()
sdkContext = DGis.initialize(
this
)
}
}
```
--------------------------------
### start()
Source: https://docs.2gis.com/en/ios/sdk/reference/10.5/class
Starts the navigator operation without specific route build options. This method is used for basic navigator startup.
```APIDOC
## start()
### Description
Starts the navigator operation.
### Method
`public func start() throws`
```
--------------------------------
### Complete RasterJS Map Example
Source: https://docs.2gis.com/en/maps/others/rasterjs/start
This example demonstrates a full HTML page setup including library loading, map initialization, and adding a marker with a popup.
```html
Maps API
```
--------------------------------
### Comprehensive Rules File Example
Source: https://docs.2gis.com/en/on-premise-api-platform/api-platform/install/navigation
A complete example of a `rules.yaml` file containing various rules for different query types and transport modes. Copy only the necessary blocks for your installation.
```yaml
rules:
- name: freeroam
queries: ["free_roam"]
routing: []
- name: all-car
queries: ["routing", "get_hull", "map_matching", "route_planner", "area_clustering", "get_pairs", "get_dist_matrix"]
routing: ["driving"]
- name: all-truck
queries: ["routing", "get_dist_matrix"]
routing: ["truck"]
- name: all-pedestrian
queries: ["routing", "get_hull", "get_pairs", "get_dist_matrix"]
routing: ["pedestrian"]
- name: all-bicycle
queries: ["routing", "get_hull", "get_pairs", "get_dist_matrix"]
routing: ["bicycle", "scooter"]
- name: all-taxi
queries: ["routing", "get_pairs", "get_dist_matrix"]
routing: ["taxi"]
- name: all-motorcycle
queries: ["routing", "get_hull", "get_dist_matrix"]
routing: ["motorcycle"]
- name: all-ctx
queries: ["public_transport", "get_dist_matrix", "get_hull"]
routing: ["public_transport", "ctx"]
- name: emergency
queries: ["routing"]
routing: ["emergency"]
- name: async-car
queries: ["get_dist_matrix"]
routing: ["driving"]
- name: async-truck
queries: ["get_dist_matrix"]
routing: ["truck"]
- name: async-bicycle
queries: ["get_dist_matrix"]
routing: ["bicycle", "scooter"]
- name: async-pedestrian
queries: ["get_dist_matrix"]
routing: ["pedestrian"]
- name: async-ctx
queries: ["get_dist_matrix"]
routing: ["ctx"]
- name: route-planner
queries: ["route_planner", "area_clustering"]
routing: ["driving"]
```
--------------------------------
### Initialize Container with HttpOptions
Source: https://docs.2gis.com/en/ios/sdk/reference/12.0/HttpOptions
Demonstrates initializing the Container with custom HTTP options. This allows for fine-grained control over network request behavior, such as caching.
```swift
public required init(
keySource: KeySource = .default,
logOptions: LogOptions = .default,
httpClientForRequest: IHTTPClient? = nil,
httpOptions: HttpOptions = HttpOptions(),
locationProvider: ILocationProvider? = nil,
magneticHeadingProvider: IMagneticHeadingProvider? = nil,
personalDataCollectionOptions: PersonalDataCollectionOptions = .default,
vendorConfig: VendorConfig = .none
)
```
--------------------------------
### Review Information Example
Source: https://docs.2gis.com/en/android/sdk/examples/directory
Shows how to display review data for a business, including the average rating and the number of reviews.
```kotlin
reviews: Reviews(rating=4.0, count=25)
```
--------------------------------
### Opening Hours Example
Source: https://docs.2gis.com/en/android/sdk/examples/directory
Defines the weekly opening hours for a business, specifying start and end times for each day. This example shows a business open daily from 8:00 to 23:00.
```kotlin
# The branch is open every day from 8:00 to 23:00
openingHours:
OpeningHours(
weekOpeningHours=[
[WeekTimeInterval(
startTime=WeekTime(weekDay=MONDAY, time=DayTime(hours=8, minutes=0)),
finishTime=WeekTime(weekDay=MONDAY, time=DayTime(hours=23, minutes=0))
)],
[WeekTimeInterval(
startTime=WeekTime(weekDay=TUESDAY, time=DayTime(hours=8, minutes=0)),
finishTime=WeekTime(weekDay=TUESDAY, time=DayTime(hours=23, minutes=0))
)],
[WeekTimeInterval(
startTime=WeekTime(weekDay=WEDNESDAY, time=DayTime(hours=8, minutes=0)),
finishTime=WeekTime(weekDay=WEDNESDAY, time=DayTime(hours=23, minutes=0))
)],
[WeekTimeInterval(
startTime=WeekTime(weekDay=THURSDAY, time=DayTime(hours=8, minutes=0)),
finishTime=WeekTime(weekDay=THURSDAY, time=DayTime(hours=23, minutes=0))
)],
[WeekTimeInterval(
startTime=WeekTime(weekDay=FRIDAY, time=DayTime(hours=8, minutes=0)),
finishTime=WeekTime(weekDay=FRIDAY, time=DayTime(hours=23, minutes=0))
)],
[WeekTimeInterval(
startTime=WeekTime(weekDay=SATURDAY, time=DayTime(hours=8, minutes=0)),
finishTime=WeekTime(weekDay=SATURDAY, time=DayTime(hours=23, minutes=0))
)],
[WeekTimeInterval(
startTime=WeekTime(weekDay=SUNDAY, time=DayTime(hours=8, minutes=0)),
finishTime=WeekTime(weekDay=SUNDAY, time=DayTime(hours=23, minutes=0))
)]
],
isOpen24x7=false
),
```
--------------------------------
### point (property)
Source: https://docs.2gis.com/en/android/sdk/reference/12.0/androidx.car.app.AppManager
Gets the starting point of the extended route element's segment.
```APIDOC
## point (property)
### Description
Gets the starting point of the segment.
### Returns
- **RoutePoint** - The route point.
```
--------------------------------
### NavigationManager.start()
Source: https://docs.2gis.com/en/android/sdk/reference/10.1/class
Starts route guidance without specific route options.
```APIDOC
## NavigationManager.start()
### Description
Starts route guidance.
### Method
```
fun start(): Unit
```
### Returns
- Unit
```
--------------------------------
### Address Autocomplete Example
Source: https://docs.2gis.com/en/api/search/suggest/examples
Use this endpoint to get address suggestions based on a query.
```http
https://catalog.api.2gis.com/3.0/suggests?q=Moscow Li&suggest_type=address&key=YOUR_KEY
```
--------------------------------
### Start Navigation (with Options)
Source: https://docs.2gis.com/en/ios/sdk/reference/10.0/class
Starts the route guidance with specified route build options and an optional traffic route.
```APIDOC
## start(routeBuildOptions: RouteBuildOptions, trafficRoute: TrafficRoute? = nil) throws
### Description
Starts the route guidance.
### Parameters
#### routeBuildOptions
- **RouteBuildOptions**: Parameters with which the navigator will rebuild the route.
#### trafficRoute
- **TrafficRoute?**: Route on which tracking is started. If not set, the navigator builds a route from the current position.
```
--------------------------------
### Catalog Object Autocomplete Example
Source: https://docs.2gis.com/en/api/search/suggest/examples
Use this endpoint to get autocomplete suggestions for catalog objects.
```http
https://catalog.api.2gis.com/3.0/suggests?q=Moscow Li&suggest_type=object&key=YOUR_KEY
```
--------------------------------
### Package Installation
Source: https://docs.2gis.com/en/android/sdk/reference/7.0/class
Initiates the installation or update process for a package. This method is used to manage data modules within the 2GIS SDK.
```kotlin
fun install(): Unit
```
--------------------------------
### Initialize SDK with Key from Asset
Source: https://docs.2gis.com/en/ios/sdk/start
Use this method to load the license key from the application's main bundle. Ensure the 'dgissdk.key' file is added to your project's root.
```swift
// Getting the key file
let key = KeySource.fromAsset(KeyFromAsset(path: "dgissdk.key"))
// Creating the Container
let sdk = DGis.Container(keySource: key)
```
--------------------------------
### DGCLI Configuration File Example
Source: https://docs.2gis.com/en/on-premise-api-platform/preparation
Example of a dgctl-config.yaml file used to configure the DGCLI utility for downloading installation artifacts. Specify component versions, storage details, and Docker registry credentials.
```yaml
key: DEMO-KEY-DGCTL-AAAAAA-BBBBBB
log-format: json
storage:
type: s3
host: artifacts.example.com
bucket: onpremise-artifacts
access-key: AKIAIOSFODNN7EXAMPLE
secret-key: wJalrXUtnFEMIK7MDENGbPxRfiCYEXAMPLEKEY
docker:
registry:
username: registry
password: DOCKERregistryP@ssW0rd
server-address: https://docker.registry.example.com
image-prefix: /
# For utility version 3
components:
core:
version:
api-platform:
version:
```
--------------------------------
### EntranceInfo Example
Source: https://docs.2gis.com/en/flutter/sdk/examples/directory
Demonstrates the structure for defining entrance information for a building.
```dart
EntranceInfo(
id: DgisObjectId(objectId: 70000001067100914, entranceId: 70030076171889579),
buildingNumber: null,
porchName: null,
porchNumber: null,
apartmentRanges: [],
geometry: EntranceGeometry(
entrancePoints: [
GeoPoint(
latitude: Latitude(value: 25.290353695590525),
longitude: Longitude(value: 55.38058040032387),
),
],
entrancePolylines: [
[
GeoPoint(
latitude: Latitude(value: 25.290443),
longitude: Longitude(value: 55.380568),
),
GeoPoint(
latitude: Latitude(value: 25.290354),
longitude: Longitude(value: 55.38058),
),
],
],
),
),
)
```
--------------------------------
### Routing API Request Example
Source: https://docs.2gis.com/en/api/navigation/routing/examples/options
A cURL request example for the Routing API, specifying start and end points, transport mode, output detail level, locale, and the number of alternative routes.
```bash
curl --request POST \
--url 'https://routing.api.2gis.com/routing/7.0.0/global?key=API_KEY' \
--header 'Content-Type: application/json' \
--data '{ \
"points": [ \
{
"type": "stop",
"lon": 37.582591,
"lat": 55.775364
},
{
"type": "stop",
"lon": 37.656625,
"lat": 55.765036
}
],
"transport": "driving",
"output": "detailed",
"locale": "en",
"alternative": 2
}' \
```
--------------------------------
### Speech Recognition Usage Example
Source: https://docs.2gis.com/en/android/sdk/reference/13.0/class
Demonstrates how to enable and disable voice input for the SearchLayout using the setupSpeechRecognition method.
```kotlin
// Enable voice input
searchLayout.setupSpeechRecognition( DefaultSpeechRecognizer(activity, "Speak") )
// Disable voice input
searchLayout.setupSpeechRecognition(null)
```
--------------------------------
### Isochrone API Response Example
Source: https://docs.2gis.com/en/api/navigation/isochrone/examples
This is an example of a successful response from the Isochrone API when requesting an availability zone with a specified departure time. It includes the geometry of the zone, start point, and transport details.
```json
{
"isochrones": [
{
"duration": 600,
"geometry": "MULTIPOLYGON(((55.230229 25.159052, 55.248325 25.176208, 55.251272 25.171943, 55.248325 25.166289, 55.25641 25.172638, 55.261327 25.171152, 55.259861 25.175602, 55.262474 25.17822, 55.265843 25.177431, 55.266516 25.170375, 55.267619 25.174604, 55.27258 25.173369, 55.286728 25.181735, 55.294813 25.178934, 55.311272 25.181089, 55.297301 25.184747, 55.304919 25.18932, 55.296225 25.193892, 55.313495 25.200764, 55.318815 25.208523, 55.317383 25.208828, 55.31288 25.206806, 55.308962 25.202115, 55.294813 25.202199, 55.292238 25.210352, 55.300517 25.214009, 55.296137 25.215207, 55.297617 25.22386, 55.293934 25.22498, 55.294813 25.225943, 55.299065 25.224791, 55.302315 25.230993, 55.319068 25.227418, 55.307464 25.234122, 55.307614 25.243873, 55.301483 25.233574, 55.292792 25.237866, 55.28875 25.231332, 55.282841 25.232294, 55.286186 25.230466, 55.276622 25.217109, 55.271883 25.218864, 55.272881 25.225253, 55.264495 25.225121, 55.261014 25.218987, 55.250282 25.215896, 55.250083 25.201208, 55.245915 25.19537, 55.249582 25.184747, 55.243429 25.187633, 55.244283 25.193384, 55.238078 25.190363, 55.238114 25.184652, 55.246936 25.17926, 55.234133 25.170154, 55.23411 25.166516, 55.229871 25.160967, 55.230229 25.159052))",
"start_point": {
"lon": 55.272799993546045,
"lat": 25.199180003614458
},
"attract_points": [
{
"lon": 55.27284580762553,
"lat": 25.199175045379135
}
]
}
],
"format": "wkt",
"transport": "driving",
"status": "OK",
"generation_time": 0
}
```
--------------------------------
### Start Route Simulation
Source: https://docs.2gis.com/en/android/sdk/reference/7.0/class
Starts a simulation of following the route. Requires route build options and a traffic route.
```kotlin
fun startSimulation(routeBuildOptions: RouteBuildOptions, trafficRoute: TrafficRoute): Unit
```
--------------------------------
### RoutePointMapObject
Source: https://docs.2gis.com/en/android/sdk/reference/7.0/class
A feature that is part of a route on the map (for example, the starting or the finish point of a route). Extends ru.dgis.sdk.map.MapObject.
```APIDOC
## RoutePointMapObject
### Description
A feature that is part of a route on the map (for example, the starting or the finish point of a route).
### Properties
#### route
**val** route: TrafficRoute
The route, the part of which the given feature represents.
#### routeIndex
**val** routeIndex: RouteIndex
Route index.
#### kind
**val** kind: RoutePointKind
Route feature type.
#### routePoint
**val** routePoint: RoutePoint
Position on the route corresponding to the given feature.
#### pointChannel
**val** pointChannel: StatefulChannel
Geographic coordinates at which this feature is located.
#### point
**var** point: GeoPoint
Geographic coordinates at which this feature is located.
```
--------------------------------
### Initialize StorageOptions
Source: https://docs.2gis.com/en/android/sdk/reference/13.0/class
Use to specify the path for the main download storage. If not provided, a default directory is used.
```kotlin
StorageOptions(downloadStoragePath: String? = null)
```
--------------------------------
### Reverse Geocoding
Source: https://docs.2gis.com/en/android/sdk/examples/directory
Example of performing reverse geocoding to get an address from coordinates. It shows how to use `fromGeoPoint`.
```APIDOC
## Reverse Geocoding
### Description
Performs reverse geocoding to obtain the address of an object on the map by its coordinates.
### Method Signature
```kotlin
SearchQueryBuilder.fromGeoPoint(geoPoint: GeoPoint)
.build()
```
### Parameters
* `geoPoint` (GeoPoint) - The coordinates of the object.
### Request Example
```kotlin
val searchQuery = SearchQueryBuilder
.fromGeoPoint(GeoPoint(25.21653, 55.252752))
.build()
```
### Response
Returns a `DirectoryObject` containing an `address` (Address object) with detailed address components.
```
--------------------------------
### Isochrone API Response Example
Source: https://docs.2gis.com/en/api/navigation/isochrone/examples
This is an example of a successful response from the Isochrone API, showing isochrones for driving within 1200 and 600 seconds. It includes geometry in WKT format, start points, and attract points.
```json
{
"isochrones": [
{
"duration": 1200,
"geometry": "MULTIPOLYGON(((55.162837 25.09197, 55.174942 25.101938, 55.182522 25.095651, 55.178176 25.104803, 55.190642 25.114379, 55.200834 25.119792, 55.209604 25.117341, 55.219409 25.129059, 55.223451 25.125849, 55.235241 25.128594, 55.239168 25.136323, 55.249727 25.140438, 55.253283 25.137743, 55.251748 25.133768, 55.256143 25.132254, 55.249727 25.124517, 55.247706 25.127222, 55.243663 25.124334, 55.239922 25.128867, 55.235578 25.128391, 55.237189 25.124562, 55.246179 25.119444, 55.230778 25.104803, 55.229515 25.098789, 55.23166 25.0992, 55.242505 25.109512, 55.245684 25.114469, 55.25579 25.108951, 55.259159 25.119444, 55.252903 25.121274, 55.259783 25.132299, 55.267602 25.136199, 55.276002 25.134922, 55.278445 25.138125, 55.277215 25.128594, 55.280045 25.124588, 55.284087 25.138176, 55.288402 25.137989, 55.289152 25.131349, 55.296215 25.127679, 55.302311 25.132254, 55.293769 25.13187, 55.293845 25.139889, 55.296215 25.136537, 55.300257 25.140098, 55.310363 25.140344, 55.312384 25.13571, 55.313684 25.140227, 55.320492 25.143253, 55.318448 25.143373, 55.316427 25.142101, 55.302462 25.143233, 55.306321 25.150094, 55.297944 25.156304, 55.312384 25.166449, 55.317311 25.164158, 55.316427 25.160461, 55.320469 25.162648, 55.324512 25.159508, 55.321445 25.165187, 55.324512 25.167748, 55.330381 25.159523, 55.332596 25.157755, 55.334439 25.157708, 55.334618 25.156955, 55.334682 25.157928, 55.332907 25.158151, 55.332961 25.161858, 55.327662 25.167016, 55.340392 25.168846, 55.328554 25.169768, 55.31814 25.1801, 55.323091 25.180364, 55.332596 25.172724, 55.337334 25.18165, 55.33016 25.183855, 55.353819 25.185308, 55.348766 25.188281, 55.316086 25.183171, 55.309925 25.198111, 55.318448 25.205807, 55.324512 25.204077, 55.33538 25.206565, 55.333685 25.211757, 55.341407 25.215741, 55.339889 25.220056, 55.34849 25.22737, 55.344724 25.227809, 55.332921 25.219762, 55.323187 25.217597, 55.316427 25.208825, 55.314719 25.225541, 55.32071 25.227152, 55.310363 25.233882, 55.282066 25.22809, 55.272056 25.231026, 55.272335 25.236851, 55.268006 25.236511, 55.268623 25.234045, 55.259468 25.231356, 55.256313 25.226897, 55.250288 25.22737, 55.252178 25.220056, 55.241642 25.208535, 55.240416 25.215289, 55.235578 25.219107, 55.236144 25.212741, 55.232514 25.207255, 55.237929 25.207553, 55.237884 25.201511, 55.230228 25.197466, 55.231763 25.194248, 55.212632 25.173149, 55.211035 25.165187, 55.204859 25.160062, 55.199822 25.148156, 55.194853 25.147165, 55.194612 25.132254, 55.18909 25.138147, 55.186131 25.134084, 55.185048 25.129365, 55.193517 25.127112, 55.195028 25.121274, 55.189159 25.115722, 55.184922 25.117614, 55.183027 25.111543, 55.168609 25.112124, 55.173763 25.104803, 55.161602 25.093821, 55.162837 25.09197))),
"transport": "driving",
"start_point": {
"lon": 55.272799993546045,
"lat": 25.199180003614458
},
"attract_points": [
{
"lon": 55.27284580762553,
"lat": 25.199175045379135
}
],
"status": "OK"
},
{
"duration": 600,
"geometry": "MULTIPOLYGON(((55.251973 25.168642, 55.257812 25.172836, 55.263875 25.170492, 55.260668 25.174333, 55.263875 25.17853, 55.266868 25.176163, 55.265896 25.171515, 55.272477 25.18165, 55.269939 25.186238, 55.276002 25.182012, 55.283946 25.185308, 55.292236 25.198111, 55.290151 25.209345, 55.280045 25.21076, 55.278024 25.207504, 55.279682 25.210913, 55.276002 25.211564, 55.269939 25.206573, 55.261891 25.209084, 55.262631 25.204301, 55.267439 25.203598, 55.262172 25.196282, 55.254527 25.194453, 55.256437 25.19021, 55.247706 25.180187, 55.251604 25.176163, 55.251973 25.168642))),
"transport": "driving",
"start_point": {
"lon": 55.272799993546045,
"lat": 25.199180003614458
},
"attract_points": [
{
"lon": 55.27284580762553,
"lat": 25.199175045379135
}
],
"status": "OK"
}
],
"format": "wkt",
"transport": "driving",
"status": "OK",
"generation_time": 0
}
```
--------------------------------
### Start Navigation Simulation
Source: https://docs.2gis.com/en/ios/sdk/reference/10.0/INavigationView
Starts the simulation of route guidance. Requires route build options and a traffic route.
```swift
public func startSimulation(
routeBuildOptions: RouteBuildOptions,
trafficRoute: TrafficRoute
) throws
```
--------------------------------
### Initialize Navigation SDK and UI
Source: https://docs.2gis.com/en/ios/sdk/examples/navigation
This code snippet demonstrates the complete setup for the navigation SDK. It includes creating a map view, initializing the NavigationManager, adding a geolocation marker, and setting up the navigation view with a close button callback. Ensure the SDK context and container view are properly initialized before use.
```swift
guard let mapFactory = try? sdk.makeMapFactory(options: .default) else {
return
}
// Adding the map layer to the View hierarchy
let mapView = mapFactory.mapView
mapView.translatesAutoresizingMaskIntoConstraints = false
containerView.addSubview(mapView)
NSLayoutConstraint.activate([
mapView.leftAnchor.constraint(equalTo: containerView.leftAnchor),
mapView.rightAnchor.constraint(equalTo: containerView.rightAnchor),
mapView.topAnchor.constraint(equalTo: containerView.topAnchor),
mapView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor)
])
// Creating a NavigationManager object
let navigationManager = NavigationManager(platformContext: sdk.context)
// Adding the map to the navigator
let map = mapFactory.map
navigationManager.mapManager.addMap(map: map)
// Adding a marker with the current geolocation to the map
let locationSource = MyLocationMapObjectSource(context: sdk.context)
map.addSource(source: locationSource)
// Creating a factory of navigator UI components
let navigationViewFactory = sdk.makeNavigationViewFactory()
// Creating a navigator layer and adding it to the View hierarchy above the map layer
let navigationView = navigationViewFactory.makeNavigationView(
map: map,
navigationManager: navigationManager
)
navigationView.translatesAutoresizingMaskIntoConstraints = false
containerView.addSubview(navigationView)
NSLayoutConstraint.activate([
navigationView.leftAnchor.constraint(equalTo: containerView.leftAnchor),
navigationView.rightAnchor.constraint(equalTo: containerView.rightAnchor),
navigationView.topAnchor.constraint(equalTo: containerView.topAnchor),
navigationView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor)
])
// Adding an event handler for the close button
navigationView.closeButtonCallback = { [weak navigationManager] in
navigationManager?.stop()
}
```
--------------------------------
### Synchronous Mode POST Request Example
Source: https://docs.2gis.com/en/api/navigation/distance-matrix/start
Send a POST request with route points and source/target indices in the JSON body. This example demonstrates calculating routes for two starting points and two end points.
```curl
curl --request POST \
--url 'https://routing.api.2gis.com/get_dist_matrix?key=API_KEY&version=2.0' \
--header 'Content-Type: application/json' \
--data '{ \
"points": [ \
{ \
"lat": 54.99770587584445, \
"lon": 82.79502868652345 \
}, \
{ \
"lat": 54.99928130973027, \
"lon": 82.92137145996095 \
}, \
{ \
"lat": 55.04533538802211, \
"lon": 82.98179626464844 \
}, \
{ \
"lat": 55.072470687600536, \
"lon": 83.04634094238281 \
} \
], \
"sources": [0, 1], \
"targets": [2, 3] \
}' \
```
--------------------------------
### Helm Configuration for Search API v8 Installation
Source: https://docs.2gis.com/en/on-premise-api-platform/api-platform/install/search-v8
Example Helm configuration file (`values-search-api-v8.yaml`) for a fresh installation of Search API v8. This file specifies registry, storage, and resource allocation for various components.
```yaml
dgctlDockerRegistry: docker.registry.example.com
dgctlStorage:
host: artifacts.example.com
secure: true
bucket: onpremise-artifacts
accessKey: AKIAIOSFODNN7EXAMPLE
secretKey: wJalrXUtnFEMIK7MDENGbPxRfiCYEXAMPLEKEY
manifest: manifests/search-api-v8/1640661259.json
region: ''
worker:
resources:
requests:
cpu: 1400m
memory: 5500Mi
limits:
cpu: 6000m
memory: 7500Mi
head:
head:
resources:
requests:
cpu: 900m
memory: 4600Mi
limits:
cpu: 2000m
memory: 8Gi
nginx:
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 250m
memory: 256Mi
envoy:
resources:
requests:
cpu: 200m
memory: 128Mi
limits:
cpu: 800m
memory: 512Mi
ingressRouter:
enabled: true
resources:
requests:
cpu: 1
memory: 400Mi
limits:
cpu: 2
memory: 2Gi
geodetector:
enabled: true
resources:
requests:
cpu: 1
memory: 4000Mi
limits:
cpu: 2
memory: 6Gi
indexer:
resources:
requests:
cpu: 500m
memory: 2Gi
limits:
cpu: 4000m
memory: 16Gi
controller:
resources:
requests:
cpu: 100m
memory: 50Mi
limits:
cpu: 200m
memory: 1Gi
filesStorage:
resources:
requests:
cpu: 500m
memory: 2Gi
limits:
cpu: 8000m
memory: 4Gi
dataAdapter:
resources:
requests:
cpu: 100m
memory: 500Mi
limits:
cpu: 200m
memory: 1Gi
ingress:
enabled: true
className: nginx
hosts:
- host: search-api-v8.example.com
paths:
- path: /
pathType: Prefix
customCAs:
bundle: ''
# bundle: |
# -----BEGIN CERTIFICATE-----
# ...
# -----END CERTIFICATE-----
certsPath: ''
```
--------------------------------
### Start Navigation Simulation
Source: https://docs.2gis.com/en/ios/sdk/reference/10.0/class
Starts the simulation of route guidance using specified route build options and a traffic route.
```swift
public func startSimulation(
routeBuildOptions: RouteBuildOptions,
trafficRoute: TrafficRoute
) throws
```
--------------------------------
### Package Uninstallation
Source: https://docs.2gis.com/en/android/sdk/reference/7.0/class
Starts the operation to remove a package from the 2GIS SDK. This is used for managing installed data modules.
```kotlin
fun uninstall(): Unit
```
--------------------------------
### Initialize BicycleInstructionStart
Source: https://docs.2gis.com/en/android/sdk/reference/7.0/class
Represents the beginning of the cycling part of a route. No specific setup is required beyond instantiation.
```kotlin
BicycleInstructionStart()
```
--------------------------------
### Route Endpoint Autocomplete Example
Source: https://docs.2gis.com/en/api/search/suggest/examples
Use this endpoint to get route endpoint suggestions, such as public transport stops.
```http
https://catalog.api.2gis.com/3.0/suggests?q=Moscow Li&suggest_type=route_endpoint&key=YOUR_KEY
```
--------------------------------
### Direct Geocoding
Source: https://docs.2gis.com/en/android/sdk/examples/directory
Example of performing direct geocoding to get coordinates from an address. It shows how to use `fromQueryText` and `setAllowedResultTypes`.
```APIDOC
## Direct Geocoding
### Description
Performs direct geocoding to obtain the coordinates of an object on the map by its address.
### Method Signature
```kotlin
SearchQueryBuilder.fromQueryText(text: String)
.setAllowedResultTypes(allowedResultTypes: List)
.build()
```
### Parameters
* `text` (String) - The address of the object.
* `allowedResultTypes` (List) - Recommended. Specifies the type of object whose coordinates you want to obtain.
### Request Example
```kotlin
val searchQuery = SearchQueryBuilder
.fromQueryText("\u200b171, Jumeirah road, Dubai")
.setAllowedResultTypes(allowedResultTypes = listOf(ObjectType.BUILDING))
.build()
```
### Response
Returns a `DirectoryObject` containing `markerPosition` (GeoPointWithElevation) with latitude and longitude.
```
--------------------------------
### 2GIS Navigation API - Car Routing Example
Source: https://docs.2gis.com/en/api/navigation/directions/reference/directions_601
Example request body for building a car route, including points, exclusions, and locale settings. This endpoint is available only when the 2GIS API Platform is installed in a private network (On-Premise).
```json
{
"type": "result",
"query": {
"alternative": 0,
"exclude": [
{
"extent": 100,
"points": [
{
"x": 82.03057,
"y": 54.043207
}
],
"severity": "hard",
"type": "point"
},
{
"extent": 1000,
"points": [
{
"x": 82.13057,
"y": 54.143207
},
{
"x": 82.23057,
"y": 54.243207
}
],
"severity": "soft",
"type": "polyline"
}
],
"locale": "ru",
"need_altitudes": true,
"point_a_name": "Source",
"point_b_name": "Target",
"points": [
{
"start": true,
"type": "walking",
"x": 82.93057,
"y": 54.943207
},
{
"object_id": "141476222741292",
"start": false,
"type": "walking",
"x": 82.945039,
"y": 55.033879
}
],
"type": "jam"
},
"message": "string",
"status": "OK",
"result": [
{
"algorithm": "с учётом пробок",
"altitudes_info": {
"elevation_gain": 10690,
"elevation_loss": 9570,
"max_altitude": 10900,
"max_road_angle": 4,
"min_altitude": 7100
},
"begin_pedestrian_path": {
"geometry": {
"selection": "LINESTRING(82.930569 54.943206, 82.930674 54.943273, 82.930683 54.943330, 82.930723 54.943655)"
}
},
"end_pedestrian_path": {
"geometry": {
"selection": "LINESTRING(82.945324 55.033714, 82.945039 55.033878)"
}
},
"filter_road_types": [
"dirt_road",
"highway"
],
"id": "7669814625906049348",
"maneuvers": [
{
"comment": "Source",
"icon": "start"
```
--------------------------------
### Package Install with Fallback Method
Source: https://docs.2gis.com/en/android/sdk/reference/13.0/class
Initiates a package installation or update operation with specified fallback behavior on error.
```kotlin
fun install(fallback: InstallFallback): Unit
```
--------------------------------
### Entrance Information Example
Source: https://docs.2gis.com/en/android/sdk/examples/directory
Details how to represent entrance information for a building, including unique identifiers and geographical coordinates for entrance points and polylines.
```kotlin
entrances: [
EntranceInfo(
id=DgisObjectId(objectId=70000001006332208, entranceId=139336470023548743),
buildingNumber=null,
porchName=null,
porchNumber=null,
apartmentRanges=[],
geometry=EntranceGeometry(
entrancePoints=[
GeoPoint(latitude=Latitude(value=25.216795), longitude=Longitude(value=55.25238)),
GeoPoint(latitude=Latitude(value=25.216828), longitude=Longitude(value=55.253393)),
GeoPoint(latitude=Latitude(value=25.215802), longitude=Longitude(value=55.252601))
],
entrancePolylines=[
[
GeoPoint(latitude=Latitude(value=25.216846), longitude=Longitude(value=55.252298)),
GeoPoint(latitude=Latitude(value=25.216795), longitude=Longitude(value=55.25238))
],
[
GeoPoint(latitude=Latitude(value=25.216902), longitude=Longitude(value=55.253455)),
GeoPoint(latitude=Latitude(value=25.216828), longitude=Longitude(value=55.253393))
],
[
GeoPoint(latitude=Latitude(value=25.215737), longitude=Longitude(value=55.252301)),
GeoPoint(latitude=Latitude(value=25.215802), longitude=Longitude(value=55.252601))
]
]
)
)
]
```