Location

An app using maps usually tracks a user’s location and displays it on the map. The NAVER Maps SDK helps you easily implement such features by providing the location overlay and location tracking feature. You can also implement your own location based features, without using the embedded location tracking feature.

Location overlays

It is recommended to use a location overlay when you need to display a user’s location on the map. Only one location overlay exists on a map, and it supports location specific characteristics, such as coordinates and directions. For more information, refer to Location Overlays.

Embedded location tracking feature

The NAVER Maps SDK supports the location tracking feature which receives a user location event, displays the location on the map and moves the camera.

Location access permissions

Since the NAVER Maps SDK basically does not use user’s location information, it does not request location-related permissions from users. Therefore, for apps using the location tracking feature, you should specify NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription permission in info.plist.

The following code example specifies the NSLocationAlwaysUsageDescription permission in info.plist.

<plist version="1.0">
<dict>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Get a user location.</string>
</dict>
</plist>

Location tracking mode

You can allow location access to use the location tracking feature. There are two ways to use the location tracking feature:

  • Enable location tracking mode: Specify positionMode to programmatically enable the location tracking mode.
  • Enable current location button control: Use showLocationButton to enable the current location button control, and the location tracking mode is enabled or disabled by a user’s tap on the button.

The NAVER Maps SDK provides the following four location tracking modes, which are defined in the NMFMyPositionMode enum.

  • NMFMyPositionDisabled: Location is not tracked.
  • NMFMyPositionNormal: Location tracking is enabled, and the current location overlay moves following a user’s location. However, the map does not move.

NMFMyPositionNormal mode enabled

  • NMFMyPositionDirection: Location tracking is enabled, and the current location overlay and the camera’s coordinates move following a user’s location. If the camera moves according to an API call or a user’s gestures, the mode turns into NMFMyPositionNormal.

NMFMyPositionDirection mode enabled

  • NMFMyPositionCompass: Location tracking is enabled, and the current location overlay, the camera’s coordinates and heading move following a user’s location and direction. If the camera moves according to an API call or a user’s gestures, the mode turns into NMFMyPositionNormal.

NMFMyPositionCompass mode enabled

The following code example changes positionMode to set the location tracking mode to NMFMyPositionDirection.

naverMapView.positionMode = .direction

Swift

naverMapView.positionMode = .direction

Objective-C

self.naverMapView.positionMode = NMFMyPositionDirection;

results matching ""

    No results matching ""