# OLA Maps Integration via LowCodeAPI

## Overview

OLA Maps provides mapping and location services including directions, geocoding, reverse geocoding, and vector map tiles.

## Base Endpoint

```
https://api.lowcodeapi.com/olamaps/
```

## Authentication

LowCodeAPI handles authentication automatically. You only need to:

1. **Sign up** at https://maps.olakrutrim.com/
2. **Connect your account** in LowCodeAPI dashboard
3. **Use your `api_token`** in all requests

The `api_token` is your LowCodeAPI authentication token. LowCodeAPI will automatically:
- Fetch your OLA Maps API key from database
- Apply it as a query parameter to each request

**Auth Type**: `API Key` (Query Parameter)

## API Categories

- Utilities
- Directions API
- Search API
- Map Tiles

## Common Endpoints

### Category: Directions API

#### Provides Routable Path Between Points

**Method**: `POST` | **LowCodeAPI Path**: `/routing/v1/directions`

**Full URL**:
```
https://api.lowcodeapi.com/olamaps/routing/v1/directions?api_token={api_token}
```

**Description**: Get routing directions between two or more points with traffic metadata.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `origin` | string | Yes | Origin coordinates (lat,lng format) |
| `destination` | string | Yes | Destination coordinates (lat,lng format) |
| `waypoints` | string | No | Waypoints joined by \| separator |
| `alternatives` | boolean | No | Return multiple routes (default: false) |
| `steps` | boolean | No | Include step-by-step directions (default: true) |
| `overview` | string | No | Geometry detail: full, simplified, or false |
| `language` | string | No | Response language (kn, en, hi - default: en) |
| `traffic_metadata` | boolean | No | Include traffic congestion info (default: false) |

**Example Request**:
```bash
# Get directions from origin to destination
curl -X POST "https://api.lowcodeapi.com/olamaps/routing/v1/directions?api_token=YOUR_API_TOKEN&origin=12.972006793201695,77.5800850011884&destination=12.993103152916301,77.54332622119354&steps=true"

# With traffic metadata
curl -X POST "https://api.lowcodeapi.com/olamaps/routing/v1/directions?api_token=YOUR_API_TOKEN&origin=12.972006793201695,77.5800850011884&destination=12.993103152916301,77.54332622119354&traffic_metadata=true"
```

**Official Documentation**: https://maps.olakrutrim.com/apidocs/routing

---

### Category: Search API

#### Autocomplete Suggestions

**Method**: `GET` | **LowCodeAPI Path**: `/places/v1/autocomplete`

**Full URL**:
```
https://api.lowcodeapi.com/olamaps/places/v1/autocomplete?api_token={api_token}
```

**Description**: Get autocomplete suggestions for a location search query.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `input` | string | Yes | Search query string |
| `origin` | string | No | Origin point for distance calculation (lat,lng) |
| `location` | string | No | Bias results around this point (lat,lng) |
| `radius` | number | No | Search radius in meters |
| `strictbounds` | boolean | No | Return only results within radius |

**Example Request**:
```bash
# Get autocomplete suggestions
curl -X GET "https://api.lowcodeapi.com/olamaps/places/v1/autocomplete?input=kempe&api_token=YOUR_API_TOKEN"

# With location bias
curl -X GET "https://api.lowcodeapi.com/olamaps/places/v1/autocomplete?input=cafe&location=12.931316595874005,77.61649243443775&radius=5000&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://maps.olakrutrim.com/apidocs/places

---

#### Geocode Address

**Method**: `GET` | **LowCodeAPI Path**: `/places/v1/geocode`

**Full URL**:
```
https://api.lowcodeapi.com/olamaps/places/v1/geocode?api_token={api_token}
```

**Description**: Convert a text address to geographic coordinates.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `address` | string | Yes | Address to geocode |
| `bounds` | string | No | Bounding box to limit results (lat,lng\|lat,lng) |
| `language` | string | No | Response language (default: English) |

**Example Request**:
```bash
# Geocode an address
curl -X GET "https://api.lowcodeapi.com/olamaps/places/v1/geocode?address=MG+Road+Bangalore&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://maps.olakrutrim.com/apidocs/places

---

#### Reverse Geocode

**Method**: `GET` | **LowCodeAPI Path**: `/places/v1/reverse-geocode`

**Full URL**:
```
https://api.lowcodeapi.com/olamaps/places/v1/reverse-geocode?api_token={api_token}
```

**Description**: Convert coordinates to an address.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `latlng` | string | Yes | Coordinates to reverse geocode (lat,lng format) |

**Example Request**:
```bash
# Reverse geocode coordinates
curl -X GET "https://api.lowcodeapi.com/olamaps/places/v1/reverse-geocode?latlng=12.931316595874005,77.61649243443775&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://maps.olakrutrim.com/apidocs/places

---

### Category: Map Tiles

#### Get Map Styles

**Method**: `GET` | **LowCodeAPI Path**: `/tiles/vector/v1/styles.json`

**Full URL**:
```
https://api.lowcodeapi.com/olamaps/tiles/vector/v1/styles.json?api_token={api_token}
```

**Description**: Get array of objects for all available map styles.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/olamaps/tiles/vector/v1/styles.json?api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://maps.olakrutrim.com/apidocs/tiles

---

#### Get Style Details

**Method**: `GET` | **LowCodeAPI Path**: `/tiles/vector/v1/styles/style_name/style.json`

**Full URL**:
```
https://api.lowcodeapi.com/olamaps/tiles/vector/v1/styles/style_name/style.json?style_name={style_name}&api_token={api_token}
```

**Description**: Get detailed style configuration for map rendering clients.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `style_name` | string | Yes | Name of the style (e.g., default-light-standard) |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
# Get style details for map rendering
curl -X GET "https://api.lowcodeapi.com/olamaps/tiles/vector/v1/styles/style_name/style.json?style_name=default-light-standard&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://maps.olakrutrim.com/apidocs/tiles

---

#### Get Map Tile

**Method**: `GET` | **LowCodeAPI Path**: `/tiles/vector/v1/data/dataset_name/tiles_zoom/tiles_column/tiles_row.pbf`

**Full URL**:
```
https://api.lowcodeapi.com/olamaps/tiles/vector/v1/data/dataset_name/tiles_zoom/tiles_column/tiles_row.pbf?dataset_name={dataset_name}&tiles_zoom={tiles_zoom}&tiles_column={tiles_column}&tiles_row={tiles_row}&api_token={api_token}
```

**Description**: Get PBF (Protocol Buffer) tile data for map rendering.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `dataset_name` | string | Yes | Name of the dataset |
| `tiles_zoom` | number | Yes | Zoom level (e.g., 14) |
| `tiles_column` | number | Yes | Tile column (x coordinate) |
| `tiles_row` | number | Yes | Tile row (y coordinate) |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
# Get tile for map rendering at zoom 14
curl -X GET "https://api.lowcodeapi.com/olamaps/tiles/vector/v1/data/dataset_name/tiles_zoom/tiles_column/tiles_row.pbf?dataset_name=default&tiles_zoom=14&tiles_column=110&tiles_row=1010&api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://maps.olakrutrim.com/apidocs/tiles

---

## Usage Examples

### Example 1: Get Directions with Traffic

Calculate routes between locations with traffic information.

```bash
# Get directions from origin to destination
# Coordinates in lat,lng format
curl -X POST "https://api.lowcodeapi.com/olamaps/routing/v1/directions?api_token=YOUR_API_TOKEN&origin=12.972006793201695,77.5800850011884&destination=12.993103152916301,77.54332622119354&steps=true&traffic_metadata=true"

# Get alternative routes
curl -X POST "https://api.lowcodeapi.com/olamaps/routing/v1/directions?api_token=YOUR_API_TOKEN&origin=12.972006793201695,77.5800850011884&destination=12.993103152916301,77.54332622119354&alternatives=true"
```

### Example 2: Search and Geocode Locations

Find locations and convert addresses to coordinates.

```bash
# Get autocomplete suggestions
curl -X GET "https://api.lowcodeapi.com/olamaps/places/v1/autocomplete?input=Indiranagar+Bangalore&api_token=YOUR_API_TOKEN"

# Geocode specific address
curl -X GET "https://api.lowcodeapi.com/olamaps/places/v1/geocode?address=123+MG+Road+Bangalore+560001&api_token=YOUR_API_TOKEN"

# Reverse geocode coordinates
curl -X GET "https://api.lowcodeapi.com/olamaps/places/v1/reverse-geocode?latlng=12.9716,77.5946&api_token=YOUR_API_TOKEN"
```

### Example 3: Map Tile Rendering

Get map tiles for custom map rendering.

```bash
# List available styles
curl -X GET "https://api.lowcodeapi.com/olamaps/tiles/vector/v1/styles.json?api_token=YOUR_API_TOKEN"

# Get specific style configuration
curl -X GET "https://api.lowcodeapi.com/olamaps/tiles/vector/v1/styles/style_name/style.json?style_name=default-light-standard&api_token=YOUR_API_TOKEN"

# Get tile data at specific coordinates
# Use for map rendering in Mapbox GL, MapLibre, etc.
curl -X GET "https://api.lowcodeapi.com/olamaps/tiles/vector/v1/data/dataset_name/tiles_zoom/tiles_column/tiles_row.pbf?dataset_name=default&tiles_zoom=14&tiles_column=110&tiles_row=1010&api_token=YOUR_API_TOKEN"
```

## Complete Endpoint Reference

For a complete list of all endpoints and their parameters, refer to:
- **OpenAPI Definition**: `https://backend.lowcodeapi.com/olamaps/definition`
- **Official Provider Documentation**: https://maps.olakrutrim.com/apidocs

## Rate Limits & Best Practices

- Coordinates must be in lat,lng format (not lng,lat)
- Use autocomplete for better user experience in search
- Enable traffic_metadata for real-time routing conditions
- Cache map tiles for better performance

## Error Handling

Standard HTTP status codes apply. Ensure coordinates are valid and properly formatted.