API Documentation

Integrate Haerriz Maps into your applications

Overview

Haerriz Maps provides a JavaScript SDK for integrating AI-powered route optimization and trip planning into your web applications. Our API is built on open-source technologies and free services.

Getting Started

Include the SDK

<script src="https://maps.haerriz.com/sdk/haerriz-maps.js"></script>

Initialize the Map

const map = new HaerrizMaps({
  container: 'map-container',
  center: [12.9716, 77.5946], // Bangalore
  zoom: 13
});

Core Features

Route Optimization

// Calculate optimized route
const route = await map.calculateRoute({
  stops: [
    { lat: 12.9716, lng: 77.5946, name: 'Start' },
    { lat: 12.9352, lng: 77.6245, name: 'Destination' }
  ],
  mode: 'driving', // driving, walking, cycling, transit
  optimize: true
});

console.log(route.distance, route.duration);

Nearby Places

// Find nearby places
const places = await map.findNearbyPlaces({
  lat: 12.9716,
  lng: 77.5946,
  radius: 1000, // meters
  types: ['restaurant', 'hotel', 'fuel']
});

places.forEach(place => {
  console.log(place.name, place.type);
});

Weather Integration

// Get weather for location
const weather = await map.getWeather({
  lat: 12.9716,
  lng: 77.5946
});

console.log(weather.temperature, weather.condition);

Traffic Analysis

// Analyze traffic for route
const traffic = await map.analyzeTraffic({
  coordinates: routeCoordinates,
  time: new Date()
});

console.log(traffic.delay, traffic.avgSpeed);

Events

// Listen to map events
map.on('route-calculated', (event) => {
  console.log('Route ready:', event.route);
});

map.on('location-selected', (event) => {
  console.log('Location:', event.coordinates);
});

Configuration Options

Option Type Default Description
container string required DOM element ID for map container
center array [0, 0] Initial map center [lat, lng]
zoom number 13 Initial zoom level
theme string 'light' Map theme: 'light', 'dark'

Rate Limits

Error Handling

try {
  const route = await map.calculateRoute(options);
} catch (error) {
  if (error.code === 'RATE_LIMIT_EXCEEDED') {
    console.log('Please wait before making more requests');
  } else if (error.code === 'INVALID_COORDINATES') {
    console.log('Check your coordinate format');
  }
}

Support

Need help with the API?

Haerriz Ecosystem

Explore more from Haerriz Technologies:

Haerriz.com

Main website with comprehensive tech services and solutions

Haerriz Blog

Technical insights, tutorials, and industry analysis

Haerriz Trendz

Fashion and lifestyle e-commerce platform