Skip to content

Latest commit

 

History

History
 
 

README.md

Interactive Maps Generator

Description

Create beautiful, interactive maps with markers, popups, circles, and custom styling using Folium. Perfect for visualizing locations, routes, and geographic data.

Features

  • Interactive web-based maps
  • Custom markers with icons
  • Popup information
  • Circle overlays
  • Multiple map styles
  • Zoom and pan controls
  • Export to HTML
  • Auto-open in browser
  • Pre-built templates
  • Custom map creation

Stack

  • Language: Python
  • Libraries: folium==0.14.0 (mapping)
  • Complexity: Intermediate

Installation

pip install -r requirements.txt
python main.py

Map Templates

1. World Capitals

  • 12 major capital cities
  • Color-coded markers
  • Global view
  • Educational

2. Tourist Attractions

  • Famous European landmarks
  • Circle radius indicators
  • Detailed popups
  • Travel planning

3. Custom Map

  • User-defined center
  • Custom markers
  • Flexible zoom
  • Personalized maps

Features Explained

Interactive Elements

  • Pan: Click and drag
  • Zoom: Scroll or use +/- buttons
  • Markers: Click for popup info
  • Layers: Toggle different views

Marker Customization

  • Colors: red, blue, green, purple, orange
  • Icons: star, info-sign, home, etc.
  • Popups: Custom text and HTML
  • Tooltips: Hover information

Map Styles

  • OpenStreetMap (default)
  • Stamen Terrain
  • Stamen Toner
  • CartoDB Positron

How to Use

Basic Usage

from main import InteractiveMapsGenerator

# Create generator
generator = InteractiveMapsGenerator()

# Create map
generator.create_basic_map([40.7128, -74.0060], zoom=12)

# Add marker
generator.add_marker(
    [40.7589, -73.9851],
    "Times Square",
    icon_color='red'
)

# Save
generator.save_map('my_map.html')

Add Circles

generator.add_circle(
    [40.7128, -74.0060],
    radius=1000,  # meters
    popup_text="1km radius",
    color='blue'
)

Use Cases

  • Travel Planning: Mark destinations
  • Real Estate: Property locations
  • Business: Store locations
  • Education: Geography lessons
  • Events: Venue mapping
  • Delivery: Route planning
  • Tourism: Attraction guides
  • Research: Data visualization

Learning Outcomes

  • Folium library usage
  • Geographic coordinates
  • Web map creation
  • HTML generation
  • Interactive visualizations
  • Geospatial data
  • Map customization

Coordinate System

Latitude & Longitude

  • Latitude: -90 to 90 (N/S)
  • Longitude: -180 to 180 (E/W)
  • Format: [lat, lon]

Example Coordinates

New York: [40.7128, -74.0060]
London: [51.5074, -0.1278]
Tokyo: [35.6762, 139.6503]
Sydney: [-33.8688, 151.2093]

Advanced Features

Heatmaps

data = [[lat1, lon1], [lat2, lon2], ...]
generator.add_heatmap(data)

Polylines (Routes)

folium.PolyLine(
    locations=[[lat1, lon1], [lat2, lon2]],
    color='red',
    weight=5
).add_to(generator.map)

GeoJSON Layers

folium.GeoJson(geojson_data).add_to(generator.map)

Customization Examples

Change Map Style

folium.Map(
    location=[lat, lon],
    tiles='Stamen Terrain'  # or 'CartoDB positron'
)

Custom Icons

folium.Marker(
    location=[lat, lon],
    icon=folium.Icon(
        color='red',
        icon='home',
        prefix='fa'  # Font Awesome icons
    )
).add_to(map)

Popup with HTML

popup_html = """
<h3>Location Name</h3>
<p>Description here</p>
<img src="image.jpg" width="200">
"""
folium.Marker(
    location=[lat, lon],
    popup=folium.Popup(popup_html, max_width=300)
).add_to(map)

Real-World Applications

Store Locator

  • Mark all store locations
  • Add store details in popups
  • Color-code by type
  • Show service radius

Travel Itinerary

  • Mark destinations
  • Connect with routes
  • Add notes and photos
  • Share with others

Event Map

  • Show event locations
  • Add schedule info
  • Highlight main venue
  • Parking locations

Tips for Best Results

  • Use appropriate zoom levels
  • Group nearby markers
  • Keep popups concise
  • Use contrasting colors
  • Test on mobile devices
  • Optimize for performance
  • Add legends when needed

Future Enhancements

  • Marker clustering
  • Route optimization
  • Distance calculations
  • Area measurements
  • Custom tile layers
  • Offline maps
  • GPS integration
  • Real-time updates
  • Database integration
  • API endpoints
  • Mobile app version

Troubleshooting

Map not displaying

  • Check HTML file location
  • Verify coordinates format
  • Ensure internet connection
  • Check browser console

Markers not showing

  • Verify coordinate order [lat, lon]
  • Check zoom level
  • Ensure marker added to map

Performance issues

  • Limit number of markers
  • Use marker clustering
  • Optimize data loading

Resources

Getting Coordinates

  • Google Maps: Right-click → "What's here?"
  • OpenStreetMap: Click location
  • GPS devices
  • Geocoding APIs

Map Tiles

  • OpenStreetMap
  • Mapbox
  • Stamen
  • CartoDB
  • Google Maps (requires API key)

License

Open source for educational purposes.