QuipuEco’s map screen is the core navigational feature of the app — it shows all nearby Tambo store drop-off points and Lima Este municipal Centros Verdes on an immersive dark-mode map, uses the device’s GPS to geolocate the user, and draws a live walking route from the user’s position to any selected recycling point. All of this is powered by Mapbox GL JS, a WebGL-based mapping library. You need a Mapbox access token before the map will render.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/davidmpizarro/QuipuEco-Hackaton/llms.txt
Use this file to discover all available pages before exploring further.
What Mapbox provides to QuipuEco
Dark-mode map tiles
Raster tiles from CARTO’s
dark_all style are used instead of the default Mapbox Streets tileset, matching QuipuEco’s dark green UI theme.GPS geolocation
GeolocateControl tracks the user’s real-time position on the map and is triggered automatically on load, so the map centers on the user immediately.Custom markers and popups
Each recycling point renders as a
mapboxgl.Marker with a custom DOM element. Tapping a marker opens a mapboxgl.Popup with the point’s address and district.Directions API
Walking routes between the user’s GPS position and a selected recycling point are fetched from the Mapbox Directions API and drawn as a GeoJSON line layer.
Obtaining a Mapbox token
Sign up for a Mapbox account
Go to mapbox.com and create a free account. No credit card is required for the free tier, which provides generous monthly map load and API call allowances — more than enough for local development and demos.
Navigate to Access Tokens
After signing in, click your profile avatar in the top-right corner and select Account. From the account dashboard, select Access Tokens in the left sidebar.
Create a new token
Click Create a token. Give it a descriptive name (e.g.
QuipuEco Dev). For local development, the default public scopes are sufficient — the Directions API and map tile endpoints are covered by the default scope set.For production deployments, restrict the token to your deployed domain using the Allowed URLs field to prevent unauthorized usage.Copy the token
Your new token will appear in the list. It always begins with
pk. (public key prefix). Copy it to your clipboard.How the token is used in code
The token is assigned once at the module level insrc/components/VistaMapaPuntos.jsx, before any map instance is created:
src/components/VistaMapaPuntos.jsx
mapboxgl.accessToken globally means all subsequent mapboxgl.Map, mapboxgl.Marker, and Directions API calls made from this file automatically include the token. You do not need to pass it explicitly to individual API calls.
Mapbox features used by QuipuEco
Map initialization with CARTO dark tiles
The map is initialized with a custom raster tile source instead of a Mapbox-hosted style, using CARTO’s publicly availabledark_all tile layer:
src/components/VistaMapaPuntos.jsx
The map intentionally uses CARTO’s
dark_all raster tiles rather than the default Mapbox Streets or Satellite styles. This provides a dark, low-distraction background that makes QuipuEco’s green markers and route polylines visually pop against the map canvas — consistent with the app’s dark-green design system.Geolocation and navigation controls
Two built-in controls are added to the map on load:src/components/VistaMapaPuntos.jsx
Custom markers and popups
Each recycling point is rendered with a custom-styled DOM element as its marker pin, with an HTML popup containing the point’s name, address, and district:src/components/VistaMapaPuntos.jsx
Directions API and route drawing
When a user taps “Trazar ruta” on a recycling point card,VistaMapaPuntos calls the Mapbox Directions API with the walking profile and renders the response as a GeoJSON line layer:
src/components/VistaMapaPuntos.jsx
line-color is set dynamically based on the recycling category (e.g. green for plastic, blue for paper), so each route is visually associated with the material type currently being viewed.
Free tier limits
Mapbox’s free tier provides:- 50,000 map loads per month — each time
mapboxgl.Mapis instantiated counts as one load - 100,000 Directions API requests per month — each call to the
/directions/v5/endpoint counts as one request