Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Crime Patterns Webmap

Crime Patterns Webmap

Interactive crime analytics webmap with server-side aggregation for fast heatmap insights. Leaflet • PHP • PostGIS

Stack: Leaflet, Bootstrap, jQuery, PHP (PDO), PostGIS
Data: City-level crime incidents with spatial geometry
Goal: Explore hotspots, trends, and category breakdowns by place and time

Live Webmap

For a better experience, click here.

Project Overview

Crime Patterns is a city-focused analytics webmap that makes it easy to explore reported crime incidents across time, location, and category. The frontend provides interactive basemaps and filters, while the backend performs server-side aggregation to produce performant heatmap layers and summary statistics.

Why It Matters

Key Features

Architecture

Frontend

Backend

Database

Data Model Requirements

Key fields used in the app:

Recommended indexes:

CREATE INDEX crimes_master_geom_gix ON crimes_master USING GIST (geom);
CREATE INDEX crimes_master_date_idx ON crimes_master (date_reported);
CREATE INDEX crimes_master_city_idx ON crimes_master (city_name);

API Endpoints

All endpoints accept POST parameters.

Configuration

Create a config file or use environment variables:

/Applications/XAMPP/xamppfiles/htdocs/config/db.php

Supported environment variables:

Local Run (XAMPP)

  1. Start Apache (and PostgreSQL if local).

  2. Place the project in your web root.

  3. Open the site in a browser and test the filters.

Suggested Improvements