KNLocation
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
Provides location information along the route. It can also reflect information such as traffic conditions and facility types in route guidance.
TIP
Because the nature of the class is path-dependent, the positions between KNLocation derived from different paths may be inaccurate.
Example code — KNLocation
class KNLocationConstructor
Example code — Initialization
// <init>
KNLocation(pos: FloatPoint, route: KNRoute?, distFromS: Int, linkIdx: Int, polyIdx: Int)Properties
| Name | Description | Type |
|---|---|---|
pos | Position coordinates along the route (uses the KATEC coordinate system) | val pos: FloatPoint |
roadName | Name of the road currently on along the route (if there is no road name: null ) | var roadName: String? |
roadType | Type of the road currently on along the route | var roadType: KNRoadType |
facilityType | Traffic facility currently on along the route | var facilityType: KNFacilityType |
trafficSt | Traffic conditions of the road currently on along the route | var trafficSt: KNTrafficState |
trafficSpd | Driving speed information of the road currently on along the route (unit: km/h). Driving speed, also called section speed, indicates the average speed in the current section. This speed may vary depending on factors such as weather, time, and traffic volume. | var trafficSpd: Int |
Methods
avrTrafStToLocation
Provides traffic information and average speed from your current location to your destination. Average speed combines the average value of traffic information status and speed at two points.
Details
Traffic conditions and average speed on route: average speed x 10 + traffic information status
- Example: Highway returns 1004 with an average speed of 100 km/h)
fun avrTrafStToLocation( location: KNLocation ): IntParameters
| Name | Description |
|---|---|
location | Destination |
costToLocation
Returns the fee from the current location to the destination (unit: KRW).
fun costToLocation( location: KNLocation ): IntParameters
| Name | Description |
|---|---|
location | Destination |
distToLocation
Returns the distance from the current location to the destination (unit: m).
fun distToLocation( location: KNLocation ): IntParameters
| Name | Description |
|---|---|
location | Destination |
locationAfterDist
Returns a location that is a specific distance away along the route.
fun locationAfterDist( dist: Int ): KNLocation?Parameters
| Name | Description |
|---|---|
dist | Distance away |
timeToLocation
Returns the time from the current location to the destination (unit: seconds).
fun timeToLocation( location: KNLocation ): IntParameters
| Name | Description |
|---|---|
location | Destination |
isSameToLocation
Compares the location information of two objects to determine whether the location information and details are identical.
fun isSameToLocation( location: KNLocation ): BooleanParameters
| Name | Description |
|---|---|
location | Location to compare |