jungle-gif

Flightmap SDK leverages the power of opensource MBGL sdk to render our custom map dataset.Our SDK supports current version : v5.7.0 and the following features:

  • Custom map styles

  • Fast vector maps

INTEGRATING MAP

Adding the framework files into the project.

Download Mapbox framework

Add the framework files (Mapbox.framework and MapboxMobileEvents.framework) into your project directory and add these dependencies from Xcode.

Access token

The flightMap access token can be set either using the singleton class MGLAccountManager (MGLAccountManager.accessToken = "") or by adding “MGLMapboxAccessToken” key into your info.plist

Setting up the mapview.

Create an instance of type MGLMapView. To initialize, use the MGLMapView(frame: CGRect, styleURL: URL) initializer

Style url for dark theme : https://maps.flightmap.io/styles/style-dark.json

Style url for light theme: https://maps.flightmap.io/styles/style-bright.json

Add Marker

An MGLPointAnnotation object represents a one-dimensional shape located at a single geographical coordinate. Depending on how it is used, an MGLPointAnnotation object is known as a point annotation or point shape. For example, you could use a point shape to represent a city at low zoom levels, an address at high zoom levels, or the location of a long press gesture.

You can add point shapes to the map by adding them to an ,MGLShapeSource object. Configure the appearance of an >MGLShapeSource’s or MGLVectorTileSource’s point shapes collectively using an MGLCircleStyleLayer or MGLSymbolStyleLayer object.

For more interactivity, add a selectable point annotation to a map view using the -[MGLMapView addAnnotation:] method. Alternatively, define your own model class that conforms to the MGLAnnotation protocol. Configure a point annotation’s appearance using -[MGLMapViewDelegate mapView:imageForAnnotation:] or -[MGLMapViewDelegate mapView:viewForAnnotation:] (iOS only). A point annotation’s MGLShape.title and MGLShape.subtitle properties define the default content of the annotation’s callout (on iOS) or popover (on macOS).

To group multiple related points together in one shape, use an MGLPointCollection or MGLShapeCollection object.

To access a point’s attributes, use an MGLPointFeature object. A point shape is known as a Point geometry in GeoJSON.

Add Polyline

An MGLPolyline object represents a shape consisting of two or more vertices, specified as CLLocationCoordinate2D instances, and the line segments that connect them. For example, you could use an polyline to represent a road or the path along which something moves.

You can add polyline shapes to the map by adding them to an MGLShapeSource object. Configure the appearance of an MGLShapeSource’s or MGLVectorTileSource’s polylines collectively using an MGLLineStyleLayer or MGLSymbolStyleLayer object. To access a polyline’s attributes, use an MGLPolylineFeature object.

Alternatively, you can add a polyline overlay directly to a map view using the -[MGLMapView addAnnotation:] or -[MGLMapView addOverlay:] method. Configure a polyline overlay’s appearance using -[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:] and -[MGLMapViewDelegate mapView:lineWidthForPolylineAnnotation:].

The vertices are automatically connected in the order in which you provide them. The first and last vertices are not connected to each other, but you can specify the same CLLocationCoordinate2D as the first and last vertices in order to close the polyline. To fill the space within the shape, use an MGLPolygon object. To group multiple polylines together in one shape, use an MGLMultiPolyline or MGLShapeCollection object.

To make the polyline go across the antimeridian or international date line, specify some longitudes less than −180 degrees or greater than 180 degrees. For example, a polyline that stretches from Tokyo to San Francisco would have coordinates of (35.68476, -220.24257) and (37.78428, -122.41310).

let coordinates = [
CLLocationCoordinate2D(latitude: 35.68476, longitude: -220.24257),
CLLocationCoordinate2D(latitude: 37.78428, longitude: -122.41310)
]
let polyline = MGLPolyline(coordinates: coordinates, count: UInt(coordinates.count))

Let's find a way together

Get in touch to know about our Pricing Plans

Contact Us
HalloweenOffer Grab Now

Hurry up! This offer is only available till 31st October!

Jungleworks