# Peak Zone Map

### **1. Peak Zone Map Overview**

The Peak Zone Map provides a real-time visual overview of all active peak pricing areas within the Taxido admin system. Admins can monitor peak zones, surge pricing behavior, and polygon boundaries directly on an interactive map.

***

### **2. Map Interface Features**

#### **2.1 Zone Boundaries**

* Displays polygon shapes representing peak zone coverage areas
* Supports multiple overlapping polygons
* Uses color coding to differentiate:
  * **Regular zones**
  * **Active peak zones (highlighted in orange)**

#### **2.2 Surge Pricing Indicators**

* When a ride begins inside a peak zone, the system highlights:
  * Surge multiplier
  * Peak zone name
  * Applicable charges

#### **2.3 Real-time Updates**

* Peak zone changes appear instantly:
  * Creation
  * Expiration
  * Updates

***

### **3. Example – Peak Zone Map Visualization**

<figure><img src="https://74030740-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6o4UzjBZtMQpeq4oeh8s%2Fuploads%2FExIAYo7TJ4R0S7ipgaXg%2Fpeak_zone.png?alt=media&#x26;token=498b93a4-b1ed-4cc1-94ec-8147d1def479" alt=""><figcaption></figcaption></figure>

***

{% hint style="info" %}

### &#x20;<mark style="color:blue;">**Map Marker Information**</mark>

* <mark style="color:blue;">Active peak zones highlighted with</mark> <mark style="color:blue;"></mark><mark style="color:blue;">**orange polygons**</mark>
* <mark style="color:blue;">Clicking inside a zone reveals:</mark>
  * <mark style="color:blue;">Surge multiplier</mark>
  * <mark style="color:blue;">Zone details</mark>
  * <mark style="color:blue;">Remaining active duration</mark>
* <mark style="color:blue;">Ride start points show surge amount if applicable</mark>
  {% endhint %}

***

### **5. Technical Implementation Details**

#### **5.1 Key Components**

| File                 | Purpose                                                              |
| -------------------- | -------------------------------------------------------------------- |
| `PeakZoneTrait.php`  | Contains logic for creation, detection, and validation of peak zones |
| `PeakZone.php`       | ORM model representing a peak zone                                   |
| `RideRepository.php` | Calculates surge pricing when a ride starts                          |
| `Zone.php`           | Base zone model including peak surge configuration                   |

***

### **6. Database Structure**

#### **Important Tables & Columns**

**rides Table**

| Column             | Description                                |
| ------------------ | ------------------------------------------ |
| `peak_zone_id`     | Foreign key linking to `peak_zones` table  |
| `peak_zone_charge` | Surge amount applied for the specific ride |

**peak\_zones Table**

| Column           | Description                                |
| ---------------- | ------------------------------------------ |
| `name`           | Name of the peak zone                      |
| `polygon_points` | JSON polygon coordinates defining the zone |

**zones Table**

| Column                           | Description                   |
| -------------------------------- | ----------------------------- |
| `peak_price_increase_percentage` | Surge multiplier for the zone |

{% hint style="warning" %}
&#x20;**Performance Note:**\
Geospatial fields use indexed queries for fast polygon boundary checks.
{% endhint %}

***

### **7. System Monitoring & Maintenance**

#### Monitoring

* Peak zone creation & deletion logs
* Surge earnings tracked separately
* Performance metrics collected continuously

#### Maintenance

* Automatic removal of expired peak zones
* Routine geospatial index optimization
* Regular validation of configuration values

{% hint style="warning" %}
🔧 **Critical Tip:** Ensure indexes on geospatial columns remain optimized for best performance.
{% endhint %}
