Skip to content

Comments

Add preset regions, and map paths#7

Open
Json-181 wants to merge 10 commits intoJustDr00py:mainfrom
Json-181:main
Open

Add preset regions, and map paths#7
Json-181 wants to merge 10 commits intoJustDr00py:mainfrom
Json-181:main

Conversation

@Json-181
Copy link

@Json-181 Json-181 commented Nov 21, 2025

User description

This push adds in custom presets for FL, GA and the Deep southeast of the USA. It also adds in a slot for custom tile server paths, as well as several other publicly available tile servers.


PR Type

Enhancement


Description

  • Add three new tile server sources: Cycle, Google Satellite Hybrid, CartoDB Dark Matter

  • Introduce three new preset regions: Florida, Georgia, Deep Southeast USA

  • Add custom tile server path support for local server configurations

  • Update UI and documentation with new map sources and region options


Diagram Walkthrough

flowchart LR
  A["Tile Server Sources"] -->|"Add"| B["Cycle, Google Sat, CartoDB"]
  C["Region Presets"] -->|"Add"| D["Florida, Georgia, Deep Southeast"]
  E["Custom Tile Server"] -->|"Support"| F["Local Server Path"]
  B -->|"Update"| G["maps.html & meshtastic_tiles.py"]
  D -->|"Update"| G
  F -->|"Update"| G
Loading

File Walkthrough

Relevant files
Enhancement
maps.html
Add new tile server options to map UI                                       

maps.html

  • Add three new tile layer options to map style selector: Cycle,
    GoogleSatHybrid, CartoDarkMatter
  • Add corresponding tile layer URLs in JavaScript tileLayers object with
    proper coordinate formatting
  • Update both map style dropdown and tile source selection dropdown with
    new options
+8/-0     
meshtastic_tiles.py
Add tile sources and region presets                                           

meshtastic_tiles.py

  • Add Google Satellite Hybrid and CartoDB Dark Matter tile sources to
    sources dictionary
  • Include commented custom tile server template for user configuration
  • Add three new region presets: florida, georgia, deep_southeast_usa
    with bounding box coordinates
  • Update region choices in argument parser to include new regions
+24/-3   
Documentation
README.md
Document new regions and tile sources                                       

README.md

  • Update available regions list to include florida, georgia,
    deep_southeast_usa
  • Add usage examples for Google Earth Hybrid and CartoDB Dark Matter
    sources
  • Add example for custom tile server configuration
+10/-1   

added Florida bounding box
added Google earth and CartoDb
updated Google and CartoDb
addressed a zoom error
called out Florida being added to regions
added Georgia and
deep southeast usa
This path would allow the user to point the script to a custom local tile server.
add new tile servers to map gui
@qodo-code-review
Copy link

qodo-code-review bot commented Nov 21, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🔴
Insecure transport (HTTP)

Description: Insecure HTTP tile URL for CartoDB Dark Matter ('http://basemaps.cartocdn.com/...') may
cause mixed-content and MITM risks; use HTTPS.
maps.html [359-361]

Referred Code
			cycle: f"https://tile.thunderforest.com/cycle/{zoom}/{x}/{y}.png",
            Google_Sat_Hybrid: f"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={zoom}",
            CartoDb_Dark_Matter: f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
Insecure transport (HTTP)

Description: Insecure HTTP tile URL for CartoDb Dark Matter ('http://basemaps.cartocdn.com/...') may
allow man-in-the-middle and content tampering; switch to HTTPS.
meshtastic_tiles.py [150-150]

Referred Code
"CartoDb_Dark_Matter": f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
#"custom_tile_server": f __fill in custom url path here__/{zoom}/{x}/{y}.png"       #This path will require a custom tile server, preferably a local server.
Third-party licensing risk

Description: Google tile usage ('mt1.google.com/vt') may violate provider terms/licensing if not
properly licensed, risking takedown or legal issues.
maps.html [359-361]

Referred Code
			cycle: f"https://tile.thunderforest.com/cycle/{zoom}/{x}/{y}.png",
            Google_Sat_Hybrid: f"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={zoom}",
            CartoDb_Dark_Matter: f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
Third-party licensing risk

Description: Google tile usage ('mt1.google.com/vt') may violate provider terms/licensing if used
without proper authorization, posing legal and availability risks.
meshtastic_tiles.py [149-149]

Referred Code
"Google_Sat_Hybrid": f"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={zoom}",
"CartoDb_Dark_Matter": f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
Unvalidated external resource

Description: Placeholder for 'custom_tile_server' encourages arbitrary URL insertion without
authentication/HTTPS guidance, which could lead to serving tiles over insecure channels or
from untrusted hosts.
meshtastic_tiles.py [151-151]

Referred Code
    #"custom_tile_server": f __fill in custom url path here__/{zoom}/{x}/{y}.png"       #This path will require a custom tile server, preferably a local server.
}
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Insecure HTTP: The new tile source 'CartoDb_Dark_Matter' uses an insecure HTTP URL which risks
MITM attacks and violates secure data transmission requirements.

Referred Code
"cycle": f"https://tile.thunderforest.com/cycle/{zoom}/{x}/{y}.png",
"Google_Sat_Hybrid": f"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={zoom}",
"CartoDb_Dark_Matter": f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
#"custom_tile_server": f __fill in custom url path here__/{zoom}/{x}/{y}.png"       #This path will require a custom tile server, preferably a local server.

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No audit logs: New functionalities for additional tile sources and regions were added without introducing
any audit logging for critical actions like tile downloads or configuration changes, but
logging may exist elsewhere.

Referred Code
def get_tile_url(self, x, y, zoom, source="osm"):
    """Get tile URL for different map sources"""
    sources = {
        "osm": f"https://tile.openstreetmap.org/{zoom}/{x}/{y}.png",
        "satellite": f"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}",
        "terrain": f"https://tile.opentopomap.org/{zoom}/{x}/{y}.png",
        "cycle": f"https://tile.thunderforest.com/cycle/{zoom}/{x}/{y}.png",
        "Google_Sat_Hybrid": f"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={zoom}",
        "CartoDb_Dark_Matter": f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
        #"custom_tile_server": f __fill in custom url path here__/{zoom}/{x}/{y}.png"       #This path will require a custom tile server, preferably a local server.
    }
    return sources.get(source, sources["osm"])

def download_tile(self, x, y, zoom, source="osm"):
    """Download a single tile"""

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Input validation: New region choices and tile sources were added without visible validation or error
handling for invalid selections or network failures in these hunks, though handling may
exist outside the diff.

Referred Code
def main():
    parser = argparse.ArgumentParser(description='Generate map tiles for Meshtastic T-Deck')

    # Method selection (mutually exclusive)
    method_group = parser.add_mutually_exclusive_group(required=True)
    method_group.add_argument('--region', type=str, 
                        choices=['north_america', 'usa', 'canada', 'mexico', 'california', 'texas', 'alaska', 'florida'],
                        help='Predefined region')
    method_group.add_argument('--city', type=str, help='City name (e.g., "San Francisco" or "Portland, Oregon")')
    method_group.add_argument('--cities', type=str, help='Multiple cities separated by semicolons (e.g., "San Francisco; Oakland; San Jose")')
    method_group.add_argument('--coords', action='store_true', help='Use custom coordinates (requires --north, --south, --east, --west)')

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status:
No log scrubbing: The new tile source URLs and region options introduce external requests and input handling
without added structured logging or explicit avoidance of sensitive data in logs in these
changes, but logging may be managed elsewhere.

Referred Code
def get_tile_url(self, x, y, zoom, source="osm"):
    """Get tile URL for different map sources"""
    sources = {
        "osm": f"https://tile.openstreetmap.org/{zoom}/{x}/{y}.png",
        "satellite": f"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}",
        "terrain": f"https://tile.opentopomap.org/{zoom}/{x}/{y}.png",
        "cycle": f"https://tile.thunderforest.com/cycle/{zoom}/{x}/{y}.png",
        "Google_Sat_Hybrid": f"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={zoom}",
        "CartoDb_Dark_Matter": f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
        #"custom_tile_server": f __fill in custom url path here__/{zoom}/{x}/{y}.png"       #This path will require a custom tile server, preferably a local server.
    }
    return sources.get(source, sources["osm"])

def download_tile(self, x, y, zoom, source="osm"):
    """Download a single tile"""

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

qodo-code-review bot commented Nov 21, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Custom tile server implementation is incomplete

The custom tile server feature is incomplete, as it only provides a
commented-out code placeholder. A proper implementation should include a
command-line argument for users to provide a custom URL without modifying the
source code.

Examples:

meshtastic_tiles.py [151]
            #"custom_tile_server": f __fill in custom url path here__/{zoom}/{x}/{y}.png"       #This path will require a custom tile server, preferably a local server.

Solution Walkthrough:

Before:

# meshtastic_tiles.py

def get_tile_url(self, x, y, zoom, source="osm"):
    sources = {
        "osm": "...",
        "satellite": "...",
        # ...
        #"custom_tile_server": f"__fill in custom url path here__/{zoom}/{x}/{y}.png"
    }
    # Using --source custom_tile_server falls back to the default 'osm'
    return sources.get(source, sources["osm"])

def main():
    parser.add_argument('--source', ...)
    # No argument to provide a custom URL

After:

# meshtastic_tiles.py

def get_tile_url(self, x, y, zoom, source="osm", custom_url=None):
    if source == "custom" and custom_url:
        return custom_url.format(zoom=zoom, x=x, y=y)
    
    sources = {
        "osm": "...",
        "satellite": "...",
        # ...
    }
    return sources.get(source, sources["osm"])

def main():
    parser.add_argument('--source', ...)
    parser.add_argument('--custom-url', type=str, help='URL for custom tile server')
    # ...
    # Pass args.custom_url to the tile generator
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a major feature advertised in the PR description is functionally incomplete, as it's only a commented-out placeholder requiring code modification, rather than a usable implementation.

High
Possible issue
Fix invalid JavaScript syntax error

Convert the Python f-strings in maps.html to valid JavaScript strings and
correct the URL placeholders from {zoom} to {z} to fix the broken map layers.

maps.html [359-361]

-			cycle: f"https://tile.thunderforest.com/cycle/{zoom}/{x}/{y}.png",
-            Google_Sat_Hybrid: f"https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={zoom}",
-            CartoDb_Dark_Matter: f"http://basemaps.cartocdn.com/dark_all/{zoom}/{x}/{y}.png",
+			cycle: 'https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png',
+            Google_Sat_Hybrid: 'https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}',
+            CartoDb_Dark_Matter: 'http://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png',
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a copy-paste error from Python to JavaScript, which introduces a syntax error and incorrect URL placeholders, completely breaking the new map layer functionality.

High
Update argument parser with new regions

Add the missing georgia and deep_southeast_usa regions to the choices list for
the --region command-line argument to make them selectable.

meshtastic_tiles.py [377-379]

 method_group.add_argument('--region', type=str, 
-                    choices=['north_america', 'usa', 'canada', 'mexico', 'california', 'texas', 'alaska', 'florida'],
+                    choices=['north_america', 'usa', 'canada', 'mexico', 'california', 'texas', 'alaska', 'florida', 'georgia', 'deep_southeast_usa'],
                     help='Predefined region')
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that two newly added regions are not accessible via the command line because they were omitted from the argument parser's choices, making part of the new feature unusable.

Medium
General
Fix custom tile server implementation

Fix the custom_tile_server entry by correcting its syntax, uncommenting it, and
providing a clear placeholder URL to make the feature functional as documented.

meshtastic_tiles.py [151]

-#"custom_tile_server": f __fill in custom url path here__/{zoom}/{x}/{y}.png"       #This path will require a custom tile server, preferably a local server.
+"custom_tile_server": f"https://your-custom-tile-server.com/tiles/{zoom}/{x}/{y}.png" # This path will require a custom tile server, preferably a local server.
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that the custom_tile_server feature is broken due to a syntax error and being commented out, which contradicts the documentation.

Medium
  • Update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant