Skip to main content
Version: 0.x

MapSDK - Getting started

The WemapMapSDK is a library for embedding customized interactive maps within mobile applications.

Requirements​

Check common requirement.

Installation​

Check common installation.

Add a map​

Once you have the MapData, create a MapView instance, assign mapDelegate and MapData to the Map and present the view as follows:

func showMapView(mapData: MapData) {
mapView = MapView(frame: view.bounds)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
mapView.mapDelegate = self
mapView.mapData = mapData
view.addSubview(mapView)
}

Handling MapViewDelegate​

You must handle at least mapViewLoaded method in MapViewDelegate, because only when this method is called, it's safe to access MapView properties.

extension ViewController: MapViewDelegate {

func mapViewLoaded(_ mapView: MapView, style _: MLNStyle, data _: MapData) {
// now it's safe to access MapView properties
}
}

User Location​

Wemap provides various location sources to track the user's location on the map. For more info check positioning docs

By default, WemapMapSDK uses Apple’s LocationProvider to obtain raw location updates. But you can easily take any WemapPositioningSDK create LocationSource and connect it to the MapView as shown below:

func setupLocationSource(mapData: MapData) {
let locationSource = VPSARKitLocationSource(mapData: mapData) // it can be any LocationSource from WemapPositioningSDK
map.userLocationManager.locationSource = locationSource
}

The full example is available in our GitHub repository.

Examples​

For additional examples and sample implementations of WemapSDKs, visit the official GitHub repository.

Clone the repository and follow the README instructions to run the sample application.