The file-upload control (powered byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Observatorio-GC/Nodos/llms.txt
Use this file to discover all available pages before exploring further.
scripts/leaflet.filelayer.js and the toGeoJSON library) adds a cloud/file icon to the map toolbar. Clicking it opens a native file picker. The selected file is read and parsed entirely within the browser and rendered as a new vector layer on the map. No data is transmitted to a server at any point. Supported formats are GeoJSON, KML, and GPX.
Initialisation
The full setup is wrapped in an IIFE insidejs/funcionesMapa.js and runs on the window load event so that the Leaflet map object is guaranteed to exist before the control is attached:
js/funcionesMapa.js
LABEL replaces the default button text with a cloud PNG icon (js/nube.png). Point geometries are rendered as L.circleMarker objects rather than the default pin marker.
How to Use It
Open the file picker
Click the cloud icon in the map controls panel. Your browser’s native file-selection dialog will open.
Select a file
Browse to and select a GeoJSON, KML, or GPX file from your local filesystem. Only one file can be loaded at a time.
View the loaded features
The file is parsed in the browser and all features are rendered on the map using a red stroke and fill style. Point features appear as red circle markers.
Supported File Formats
| Format | Extension | Notes |
|---|---|---|
| GeoJSON | .geojson, .json | Native Leaflet vector format; supports Points, LineStrings, Polygons, and feature collections with arbitrary properties. |
| KML | .kml | Google Earth / Google Maps export format; converted to GeoJSON internally via the toGeoJSON library before rendering. |
| GPX | .gpx | GPS track/waypoint format (e.g. from Garmin, Strava exports); also converted via toGeoJSON. Tracks, routes, and waypoints are all supported. |
Customising the Loaded Layer Style
The default style uses solid red for both strokes and fills. To change it, modify thestyle object before the control is initialised:
layerOptions.style when calling L.Control.fileLayerLoad(). The pointToLayer callback can similarly be adjusted to return a different marker type or size for point features.
The data:loaded Event
After a file is successfully parsed, the control’s loader emits a data:loaded event. Hook into it to inspect, transform, or register the loaded layer with other parts of the application:
e.layer is a standard Leaflet FeatureGroup containing all parsed features. You can call any Leaflet layer method on it — getBounds(), eachLayer(), toGeoJSON(), and so on.
File processing is entirely client-side. The contents of the file you select are never sent to any server — parsing and rendering happen exclusively inside your browser using the JavaScript
FileReader API.