OpenStreetMap Extension
The OpenStreetMap extension allows you to embed interactive OpenStreetMap maps using Leaflet.js in the VistaView lightbox. No API key required - completely free!
Installation
Section titled “Installation”ESM (Module Bundlers)
Section titled “ESM (Module Bundlers)”UMD (CDN)
Section titled “UMD (CDN)”Create links with OpenStreetMap-compatible coordinate URLs:
URL Format
Section titled “URL Format”Use this format in your href attribute:
Example:
Parameters:
- LATITUDE: Latitude coordinate (e.g., 40.7580)
- LONGITUDE: Longitude coordinate (e.g., -73.9855)
- ZOOM: Zoom level (1-19, where 1 is world view and 19 is street level)
Features
Section titled “Features”- 100% Free - No API keys, no billing, no usage limits
- Interactive maps - Full Leaflet.js functionality
- Responsive sizing - Maps adapt to lightbox size
- Zoom controls - Standard map controls
- Attribution - Properly credits OpenStreetMap contributors
Map Size
Section titled “Map Size”The extension creates maps with a maximum width of 800px (or window width, whichever is smaller) while maintaining a 16:9 aspect ratio.
Mixing Images and Maps
Section titled “Mixing Images and Maps”You can mix images and OpenStreetMap maps in the same gallery:
Bundle Size
Section titled “Bundle Size”- ESM: 4.79 KB (1.90 KB gzip)
- UMD: 15.43 KB (4.79 KB gzip)
Note: Leaflet.js library (~150KB) is loaded from CDN when a map is displayed.
Why Choose OpenStreetMap?
Section titled “Why Choose OpenStreetMap?”Advantages
Section titled “Advantages”- ✅ Completely free - No API keys or billing
- ✅ No usage limits - Unlimited map loads
- ✅ Open source - Community-driven project
- ✅ Privacy-friendly - No tracking by default
- ✅ Lightweight - Smaller than commercial alternatives
Considerations
Section titled “Considerations”- Map styles are more basic than commercial providers
- Fewer built-in features compared to Google Maps/Mapbox
- Relies on community tile servers
Tile Servers
Section titled “Tile Servers”By default, the extension uses OpenStreetMap’s tile servers. Please be respectful:
- Don’t make excessive requests
- Cache tiles when possible
- Consider using your own tile server for high-traffic sites
For production sites with high traffic, consider:
- Mapbox (has free tier)
- Self-hosted tile server
- Commercial OpenStreetMap providers
Customization
Section titled “Customization”The extension uses standard OpenStreetMap tiles. To use custom tile servers or styles, you’ll need to create a custom version based on the extension source code.
Attribution
Section titled “Attribution”The extension automatically includes proper attribution to OpenStreetMap contributors as required by the OpenStreetMap license.
Limitations
Section titled “Limitations”- Internet connection required - Maps load from tile servers
- Basic styling - Standard OpenStreetMap appearance only
- Tile server load - Respect the free tile server’s resources
Example with Multiple Maps
Section titled “Example with Multiple Maps”Next Steps
Section titled “Next Steps”- Try other map extensions: Google Maps, Mapbox
- Learn about creating custom extensions
- Explore other extensions