Skip to content

noplisu/mapBlur

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—บ๏ธ Map Blur with Sharp Points of Interest (POIs)

This project demonstrates how to create a Mapbox GL JS map with a blurred overlay, while keeping specific points of interest (POIs) sharp and visible.

๐ŸŒ Live Demo: noplisu.github.io/mapBlur


โœจ Features

  • Uses Mapbox GL JS v3.10.0
  • Adds a blurred canvas layer on top of the map
  • Dynamically projects selected POI coordinates into sharp circular zones
  • Radius adjusts with zoom level for better UX
  • Handles canvas resizing and re-rendering on map movement

image


๐Ÿ“ Points of Interest (POIs)

The following cities in Poland are highlighted:

  • Gliwice ([18.6664, 50.2940])
  • Krakรณw ([19.9379, 50.0623])
  • Warszawa ([21.0031, 52.2290])

You can easily customize these in the pois array in the JavaScript section.


๐Ÿง  How It Works

  1. A canvas is placed over the map container.
  2. The map is drawn into this canvas.
  3. Using the ctx.clip() method, circular regions corresponding to POIs are carved out.
  4. The filter: blur() CSS property is applied to the canvas, blurring everything except those sharp circular areas.

image


๐Ÿ›  Usage

You can clone this repo and host it via GitHub Pages or locally with any static file server.

git clone https://github.com/noplisu/mapBlur.git
cd mapBlur
open index.html

Or simply visit the hosted version at: ๐Ÿ‘‰ https://noplisu.github.io/mapBlur/


๐Ÿ—๏ธ Mapbox Access Token

This project uses a public Mapbox access token. For public demos, this is acceptable. However, for production apps or private usage:


๐Ÿ“„ License

This project is licensed under the MIT License.


Made with โค๏ธ using Mapbox GL JS

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages