๐Ÿ‡ฑ๐Ÿ‡ฐ Sri Lanka Location Intelligence System

Find every location, business, and place in Sri Lanka using AI-powered semantic search.

A comprehensive geospatial intelligence system covering 117,446 locations across Sri Lanka โ€” including police stations, hospitals, schools, places of worship, businesses, roads, buildings, natural features, and more. Powered by multilingual-e5-large (1024-dim embeddings, 100 languages) with FAISS IVFFlat vector search for instant semantic lookup.

Model Details

Property Value
Base Model intfloat/multilingual-e5-large
Architecture XLMRobertaModel (24 layers, 16 heads)
Embedding Dimension 1024
Model Size 2.2 GB (SafeTensors)
Max Sequence Length 512 tokens
Languages 100 languages (English, Sinhala, Tamil, Hindi, Arabic, Chinese, Japanese, Korean, French, German, Spanish, and 90+ more)
License MIT (model) + ODbL (location data)

Repository Contents

File Size Description
model.safetensors 2.2 GB multilingual-e5-large model weights
models/ โ€” Tokenizer, config, and sentence-transformers config
srilanka_places.db 38 MB SQLite database of 117,446 Sri Lanka locations
srilanka_embeddings_large.npy ~480 MB Pre-computed 1024-dim embeddings (117,446 x 1024)
faiss_index_large.bin ~480 MB FAISS IVFFlat index (nlist=200) for instant semantic search
id_mapping_large.npy ~2 MB ID-to-index mapping for result retrieval
metadata.json 1 KB Model metadata and usage information

Road Coverage โ€” 38,874 Named Roads

Every named road in Sri Lanka is indexed โ€” from major highways (A1 Colombo-Kandy, E01 Southern Expressway) down to local streets (Galle Road, Marine Drive, Ward Place, Kollupitiya Road, etc.). Search by road name, find locations along roads, or discover nearby amenities.

Categories Covered

Category Count Examples
๐Ÿ›ฃ๏ธ Named Roads 38,874 A1, E01, Galle Road, Marine Drive
๐Ÿ  Buildings 11,751 Commercial, residential, government
๐Ÿ˜๏ธ Populated Places 4,482 Cities, towns, villages (Colombo, Kandy, Galle, Jaffna, etc.)
๐Ÿช Shops 4,463 Retail stores, supermarkets, pharmacies
โ›ช Places of Worship 4,401 Buddhist temples, churches, mosques, kovils
๐Ÿซ Schools 4,401 Government schools, international schools, universities
๐Ÿฅ Hospitals 902 Government hospitals, private clinics, Ayurvedic
๐Ÿš” Police Stations 420 Police stations and posts
๐Ÿฆ Banks & ATMs 1,200+ Commercial banks (BOC, People's Bank, HNB, Commercial Bank, etc.)
๐Ÿจ Hotels 850+ Hotels, guesthouses, resorts
๐Ÿฝ๏ธ Restaurants 2,000+ Restaurants, cafes, food outlets
๐Ÿ›๏ธ Government Offices 1,500+ Divisional secretariats, municipal councils, government departments
โ›ฝ Fuel Stations 600+ Petrol stations (Ceypetco, Lanka IOC, etc.)
๐ŸŒฟ Natural Features 2,500+ Rivers, mountains, forests, beaches
๐Ÿš‰ Transport Hubs 350+ Railway stations, bus stands, airports
๐ŸŸ๏ธ Landmarks 1,200+ Monuments, parks, stadiums, museums
๐Ÿ“ฆ And 10+ more categories โ€” Industrial, agricultural, utilities, etc.

Usage

Quick Start โ€” Semantic Search

from sentence_transformers import SentenceTransformer
import faiss
import numpy as np
import sqlite3
import json

# Load the model
model = SentenceTransformer('deathlegionteam/sri-lanka-location-intelligence')

# Load FAISS index and ID mapping
index = faiss.read_index('faiss_index_large.bin')
id_mapping = np.load('id_mapping_large.npy', allow_pickle=True)

# Connect to database
conn = sqlite3.connect('srilanka_places.db')
cursor = conn.cursor()

def search_locations(query, top_k=10):
    """Search any location in Sri Lanka by semantic query."""
    # Encode query
    query_vec = model.encode(['query: ' + query], normalize_embeddings=True)
    
    # Search FAISS index
    distances, indices = index.search(query_vec.astype(np.float32), top_k)
    
    # Fetch results from database
    results = []
    for i, idx in enumerate(indices[0]):
        location_id = id_mapping[idx]
        cursor.execute("SELECT * FROM locations WHERE id=?", (int(location_id),))
        row = cursor.fetchone()
        if row:
            # Convert sqlite3.Row to dict
            cols = [d[0] for d in cursor.description]
            location = dict(zip(cols, row))
            location['similarity'] = float(distances[0][i])
            results.append(location)
    
    return results

# Examples
results = search_locations("police station in Colombo")
for r in results[:5]:
    print(f"{r['name']} โ€” {r['category']} ({r['latitude']}, {r['longitude']})")

results = search_locations("Buddhist temple near Kandy")
results = search_locations("hospital with emergency services")
results = search_locations("Colombo 7 restaurant")

Category Filtering

def search_by_category(query, category, top_k=10):
    """Search within a specific category."""
    query_vec = model.encode(['query: ' + query], normalize_embeddings=True)
    distances, indices = index.search(query_vec.astype(np.float32), top_k * 3)
    
    results = []
    for idx in indices[0]:
        location_id = id_mapping[idx]
        cursor.execute("SELECT * FROM locations WHERE id=? AND category=?", 
                      (int(location_id), category))
        row = cursor.fetchone()
        if row:
            cols = [d[0] for d in cursor.description]
            location = dict(zip(cols, row))
            location['similarity'] = float(distances[0][list(indices[0]).index(idx)])
            results.append(location)
        if len(results) >= top_k:
            break
    return results

# Find hospitals in the Western Province
results = search_by_category("government hospital", "hospital", 5)

Nearby Search

import math

def haversine(lat1, lon1, lat2, lon2):
    """Calculate distance in km between two coordinates."""
    R = 6371
    dlat = math.radians(lat2 - lat1)
    dlon = math.radians(lon2 - lon1)
    a = math.sin(dlat/2)**2 + math.cos(math.radians(lat1)) * \
        math.cos(math.radians(lat2)) * math.sin(dlon/2)**2
    return R * 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))

def find_nearby(lat, lon, radius_km=5, limit=50):
    """Find locations near a point."""
    # Bounding box pre-filter
    lat_delta = radius_km / 111.0
    lon_delta = radius_km / (111.0 * abs(math.cos(math.radians(lat))) + 0.001)
    
    cursor.execute("""
        SELECT * FROM locations 
        WHERE latitude BETWEEN ? AND ?
        AND longitude BETWEEN ? AND ?
        ORDER BY ABS(latitude - ?) + ABS(longitude - ?)
        LIMIT ?
    """, (lat - lat_delta, lat + lat_delta,
          lon - lon_delta, lon + lon_delta,
          lat, lon, limit * 2))
    
    rows = cursor.fetchall()
    cols = [d[0] for d in cursor.description]
    
    results = []
    for row in rows:
        loc = dict(zip(cols, row))
        dist = haversine(lat, lon, loc['latitude'], loc['longitude'])
        if dist <= radius_km:
            loc['distance_km'] = round(dist, 2)
            results.append(loc)
            if len(results) >= limit:
                break
    
    return results

# Find everything near Colombo Fort
nearby = find_nearby(6.9344, 79.8428, radius_km=2)

Search Examples (query โ†’ actual results)

Query Finds
"police emergency" Police stations near you
"Colombo hospital" National Hospital of Sri Lanka, private hospitals in Colombo
"temple tooth relic" Temple of the Tooth, Kandy
"galle road restaurant" Restaurants along Galle Road, Colombo
"Kandy school" Schools in Kandy district
"fuel station A1" Petrol stations along the A1 highway
"beach hotel" Beach resorts and hotels
"central bank" Central Bank of Sri Lanka, Colombo
"เท€เท’เท„เทเถปเถบ" (Sinhala) Buddhist temples
"เฎ•เฏ‹เฎตเฎฟเฎฒเฏ" (Tamil) Hindu temples/kovils

Data Sources

  • OpenStreetMap (via Geofabrik download: sri-lanka-latest.osm.pbf, 136 MB)
  • License: Open Database License (ODbL) โ€” data from OpenStreetMap contributors

Coverage

  • 117,446 total locations indexed
  • 27 classification categories
  • 38,874 named roads
  • 100+ languages supported for search queries
  • Full coverage of all 9 provinces (Western, Central, Southern, Northern, Eastern, North Western, North Central, Uva, Sabaragamuwa)

Technical Architecture

User Query (in any language)
        โ†“
multilingual-e5-large (1024-dim embedding)
        โ†“
FAISS IVFFlat Index (nlist=200, cosine similarity)
        โ†“
SQLite Database โ†’ Location Name + Coordinates + Category + Tags
        โ†“
Structured Results with similarity scores

License

  • Model: MIT License (intfloat/multilingual-e5-large)
  • Location Data: Open Database License (ODbL) โ€” ยฉ OpenStreetMap contributors
  • System: MIT License

Links

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support