The Eco-It recycling map gives every visitor — logged in or not — an interactive view of active waste-collection and recycling points in their city. It is built with Leaflet.js, embedded in the React SPA, and renders custom SVG pin markers for each point type. Map data is served from a public REST endpoint so no authentication is required to browse the map, though route planning and favorites require a user account.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vanegasjoseignacio2-cyber/Eco-It/llms.txt
Use this file to discover all available pages before exploring further.
Point Types
Every recycling point stored in the database belongs to exactly one of the following five categories, defined as an enum on thePuntoReciclaje Mongoose model:
recycling
A standard recycling drop-off point. Renders with a green pin on the map.
ecobottle
An eco-bottle deposit station. Renders with a lime pin.
truck
A scheduled collection truck stop. Renders with a teal pin.
container
A large waste container. Renders with an emerald pin.
green_zone
A designated green zone for organic or composting drop-off. Renders with a light-green pin.
Data Model
ThePuntoReciclaje schema (defined in backend/models/puntoReciclaje.js) stores the following fields for each point:
Display name of the recycling point shown in the map popup and result list.
One of
recycling, ecobottle, truck, container, or green_zone. Determines the marker icon and color.Latitude coordinate (WGS 84 decimal degrees).
Longitude coordinate (WGS 84 decimal degrees).
Optional description shown inside the Leaflet popup when a user clicks the pin.
Optional Cloudinary URL of a photo of the point. Displayed as a thumbnail inside the popup.
When
false, the point is hidden from the public map and excluded from the public API response. Defaults to true.Secondary visibility flag. Both
activo and visibleToUser must be true for a point to appear on the public map. Defaults to true.Public API
GET /api/map/points
Returns all recycling points where activo: true and visibleToUser: true, sorted by creation date descending. No authentication required.
true when the query succeeds.Array of active, user-visible recycling point objects. Each object contains
id, nombre, tipo, lat, lng, descripcion, and imagen.Admin CRUD API
Administrators manage recycling points through a set of protected endpoints under/api/admin/map/points. All admin endpoints require a valid JWT with an admin or superadmin role.
GET /api/admin/map/points
Returns all points regardless of
activo or visibleToUser status. Used by the admin map management panel.POST /api/admin/map/points
Creates a new recycling point. Accepts a base64 image string which is automatically uploaded to Cloudinary and stored as a secure URL.
PUT /api/admin/map/points/:id
Updates an existing point. If the
imagen field is a new data:image/... base64 string, it is re-uploaded to Cloudinary.DELETE /api/admin/map/points/:id
Permanently deletes a point from the database.
PATCH /api/admin/map/points/:id/toggle
Toggles the
activo flag between true and false without deleting the point.map:updated Socket.io event to all connected clients, broadcasting the updated list of active visible points so the map refreshes in real time without a page reload.
Frontend Map Component
TheMapView component (frontend/src/components/Maps/MapView.jsx) initializes a Leaflet map centered on the default coordinates [2.195, -75.627] at zoom level 14, constrained within bounding box [2.140, -75.690] → [2.240, -75.560] so users cannot pan outside the service area. Zoom controls are positioned at the bottom-right.
Each point is rendered with a custom L.divIcon that combines a rotated teardrop shape, a type-specific SVG icon, and a CSS ripple animation. Clicking a marker fires an onMarkerClick callback with the point’s id, name, type, coordinates, and description, which drives the result list sidebar.
The component also accepts a selectedPlace prop. When it changes, the map flies to that location at zoom 18 with a smooth animation. Selecting “Mi ubicación” places a pulsing blue dot representing the user’s current GPS position.