You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of using central cords of city +/- buffer get the boundary box of the city +/- buffer
PR Type
Enhancement
Description
Replace city center coordinates with actual boundary boxes
Use bounding box coordinates from geocoding API response
Apply buffer to boundary extents instead of center point
Improve geographic accuracy for city-based tile downloads
Diagram Walkthrough
flowchart LR
A["City Geocoding"] --> B["Extract Bounding Box"]
B --> C["Apply Buffer to Bounds"]
C --> D["Calculate Final Area"]
E["Old: Center + Buffer"] -.-> F["New: Boundary + Buffer"]
Loading
File Walkthrough
Relevant files
Enhancement
meshtastic_tiles.py
Replace center coordinates with boundary boxes
meshtastic_tiles.py
Extract bounding box coordinates from geocoding API response
Replace center-based calculations with boundary-based calculations
Update coordinate handling in both single and multiple city workflows
Apply buffer to actual city boundaries instead of center points
The code assumes boundingbox array always has 4 elements when extracting coordinates. If the geocoding API returns incomplete or malformed bounding box data, this could cause IndexError exceptions.
The buffer conversion uses a fixed approximation of 111km per degree, which is only accurate at the equator. At higher latitudes, longitude degrees represent shorter distances, making the buffer inaccurate.
Add validation to ensure the boundingbox array has at least 4 elements before accessing indices. This prevents IndexError if the API returns incomplete bounding box data.
-'south': float(result['boundingbox'][0]),-'north': float(result['boundingbox'][1]),-'west': float(result['boundingbox'][2]),-'east': float(result['boundingbox'][3]),+bbox = result.get('boundingbox', [])+if len(bbox) >= 4:+ 'south': float(bbox[0]),+ 'north': float(bbox[1]),+ 'west': float(bbox[2]),+ 'east': float(bbox[3]),+else:+ # Fallback to center point with small offset+ lat, lon = float(result['lat']), float(result['lon'])+ offset = 0.01 # ~1km+ 'south': lat - offset,+ 'north': lat + offset,+ 'west': lon - offset,+ 'east': lon + offset,
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a potential IndexError if the API returns incomplete boundingbox data and provides a sensible fallback, improving the code's robustness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Instead of using central cords of city +/- buffer get the boundary box of the city +/- buffer
PR Type
Enhancement
Description
Replace city center coordinates with actual boundary boxes
Use bounding box coordinates from geocoding API response
Apply buffer to boundary extents instead of center point
Improve geographic accuracy for city-based tile downloads
Diagram Walkthrough
File Walkthrough
meshtastic_tiles.py
Replace center coordinates with boundary boxesmeshtastic_tiles.py