ola_maps_flutter 0.2.0 copy "ola_maps_flutter: ^0.2.0" to clipboard
ola_maps_flutter: ^0.2.0 copied to clipboard

PlatformAndroid

A Flutter plugin for integrating Ola Maps SDK. Provides interactive maps with markers, polylines, circles, polygons, bezier curves, and marker clustering.

Ola Maps Flutter Plugin #

A Flutter plugin for integrating Ola Maps SDK into your Flutter applications. This plugin provides a comprehensive set of features for displaying interactive maps with markers, polylines, circles, polygons, bezier curves, and marker clustering.

Ola Maps Flutter Demo

Features #

  • Map Display - Interactive map view with gestures (zoom, pan, tilt, rotate)
  • Markers - Add, remove, and update markers with custom icons, rotation, and anchors
  • InfoWindows - Display information windows on markers
  • Polylines - Draw routes and paths on the map
  • Circles - Display circular overlays
  • Polygons - Draw multi-sided shapes for area boundaries
  • Bezier Curves - Smooth curved lines between points
  • Marker Clustering - Group nearby markers automatically
  • Camera Controls - Zoom to location, get current position
  • Location Services - Show/hide current user location
  • Routing API - Get directions and draw routes between locations

Screenshots #

Map View Markers & Overlays Clustering
Map Interactive map with all features Auto-grouped markers

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  ola_maps_flutter:
    path: path/to/ola_maps_flutter

Android Setup #

1. Add Ola Maps SDK (One-time setup) #

Download the Ola Maps SDK AAR from the plugin repository and place it in your app's android/app/libs/ directory.

Then add this to your android/app/build.gradle:

dependencies {
    // ... your other dependencies

    // Ola Maps SDK (required)
    implementation(files("libs/OlaMapSdk-1.8.4.aar"))
}

Note: Due to Android/Gradle limitations, AAR files cannot be auto-bundled with Flutter plugins. This is a one-time setup per project.

2. Permissions #

Add these permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

3. Request Runtime Permissions #

Future


## Usage

### Basic Map

```dart
import 'package:ola_maps_flutter/ola_map_view_flutter.dart';

OlaMapView(
  apiKey: "YOUR_OLA_MAPS_API_KEY",
  onMapCreated: (id) {
    print("Map created with id: $id");
  },
  onControllerReady: (controller) {
    // Map is ready, controller is available
  },
  showZoomControls: true,
  showCompass: true,
  showMyLocationButton: true,
)

Add Markers #

OlaMapController? _controller;

// Add marker
final markerId = await _controller?.addMarker(
  position: OlaLatLng(18.5214, 73.9317),
  snippet: "Ola Campus",
  subSnippet: "Tap for more info",
);

// Remove marker
await _controller?.removeMarker(markerId);

// Update marker
await _controller?.updateMarker(
  markerId: markerId,
  position: OlaLatLng(18.5220, 73.9320),
  rotation: 45.0,
);

Add Polyline #

await _controller?.addPolyline(
  points: [
    OlaLatLng(18.5214, 73.9317),
    OlaLatLng(18.5234, 73.9337),
    OlaLatLng(18.5254, 73.9357),
  ],
  color: "#FF0000",
  width: 5.0,
);

Add Circle #

await _controller?.addCircle(
  center: OlaLatLng(18.5214, 73.9317),
  radius: 500.0,
  color: "#0000FF",
  opacity: 0.3,
);

Add Polygon #

await _controller?.addPolygon(
  points: [
    OlaLatLng(18.5214, 73.9317),
    OlaLatLng(18.5234, 73.9337),
    OlaLatLng(18.5254, 73.9357),
    OlaLatLng(18.5254, 73.9317),
  ],
  color: "#00FF00",
);

Add Bezier Curve #

await _controller?.addBezierCurve(
  startPoint: OlaLatLng(18.5214, 73.9317),
  endPoint: OlaLatLng(18.5254, 73.9357),
  color: "#FF00FF",
  width: 4.0,
);

Camera Controls #

// Zoom to specific location
await _controller?.zoomToLocation(
  OlaLatLng(18.5214, 73.9317),
  15.0, // zoom level
);

// Get current location
final location = await _controller?.getCurrentLocation();

// Show current location
await _controller?.showCurrentLocation();

Routing (Directions) #

import 'package:ola_maps_flutter/ola_routing_service.dart';

// Initialize routing service
final routingService = OlaRoutingService(apiKey: "YOUR_API_KEY");

// Fetch route between two points
final routePoints = await routingService.getDirections(
  originLat: 18.7603,
  originLng: 73.3814,
  destLat: 18.7335,
  destLng: 73.4459,
);

// Draw route as polyline
final olaPoints = routePoints.map((point) =>
  OlaLatLng(point['lat']!, point['lng']!)
).toList();

await _controller?.addPolyline(
  points: olaPoints,
  color: "#0000FF",
  width: 5.0,
);

Marker Clustering #

final geoJson = '''
{
  "type": "FeatureCollection",
  "features": [...]
}
''';

await _controller?.addClusteredMarkers(
  geoJson: geoJson,
  clusterRadius: 50,
  defaultMarkerColor: "#FF0000",
  defaultClusterColor: "#00FF00",
  textSize: 12.0,
  textColor: "#FFFFFF",
);

API Reference #

OlaMapController Methods #

Method Description
addMarker() Add a marker to the map
removeMarker() Remove a marker by ID
updateMarker() Update marker properties
showInfoWindow() Show info window for marker
hideInfoWindow() Hide info window
addPolyline() Draw a polyline
addCircle() Add a circle overlay
addPolygon() Add a polygon shape
addBezierCurve() Add a curved line
addClusteredMarkers() Add clustered markers from GeoJSON
zoomToLocation() Zoom camera to location
getCurrentLocation() Get device location
showCurrentLocation() Display user location
hideCurrentLocation() Hide user location

Example App #

See the example directory for a complete working example demonstrating all features.

Requirements #

  • Flutter SDK: >=3.0.0
  • Android minSdkVersion: 21
  • Ola Maps SDK: 1.8.4

License #

MIT License - see LICENSE file for details.

Issues and Feedback #

Please file issues on the GitHub repository.

1
likes
160
points
0
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for integrating Ola Maps SDK. Provides interactive maps with markers, polylines, circles, polygons, bezier curves, and marker clustering.

Repository (GitHub)
View/report issues

Topics

#maps #ola-maps #navigation #geolocation #markers

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, plugin_platform_interface

More

Packages that depend on ola_maps_flutter

Packages that implement ola_maps_flutter