function loadExample() {

	// Load example input data
	loadGeoJSONInput('eonet_test_data.json');

	// Prefill the URL input field
	$('#layerUrl').val('eonet_test_data_2.json');

	/**
	 * Define the example script.
	 *
	 * Note that the indentation has been adjusted to maintain proper
	 * formatting in the UI.
	 */
	const exampleScript =
`// Below is an example script that demonstrates some possible operations

const eventFeatures = inputLayers // Access all input layers

	// Collect all layer features
	.reduce((prev, curr) => prev.concat(curr.features || []), [])

	// Filter features by certain criteria
	.filter(feature => {
		return feature.geometry.type === 'Point' &&
			feature.properties.id === 'EONET_5104';
	})
	
	// Create custom feature points
	.map(feature => {
		return {
			type: "Feature",
			geometry: feature.geometry,
			properties: feature.properties
		};
	});

// Sort event points by date
eventFeatures.sort((a, b) => a.properties.date > b.properties.date);

// Record the first and last events
const firstEvent = eventFeatures[0];
const lastEvent = eventFeatures[eventFeatures.length - 1];

// Log information about the selected events
console.info("Number of selected events: " + eventFeatures.length);
console.info("Event started at: " + firstEvent.properties.date);
console.info("Event ended at: " + lastEvent.properties.date);

// Color code the start and end events
firstEvent.properties.style = { fillColor: '#53d453' }; // Green
lastEvent.properties.style = { fillColor: '#ea6868' }; // Red

// Build the event path line string
const eventPath = eventFeatures.map(f => f.geometry.coordinates);

// Add a new GeoJSON layer for the event path
eventFeatures.unshift({
	type: "LineString",
	coordinates: eventPath
});

// Return the layer to display it on the map
return {
	type: 'FeatureCollection',
	features: eventFeatures
};
`;

	// Prefill the script
	sourceCode.val(exampleScript);
}
/**
 * Load example data into the UI
 */
Load example data into the UI
Load example data into the UI
function loadExample() {
	loadGeoJSONInput('eonet_test_data.json');
	$('#layerUrl').val('eonet_test_data_2.json');
	const exampleScript =
`// Below is an example script that demonstrates some possible operations
const eventFeatures = inputLayers // Access all input layers
	// Collect all layer features
	.reduce((prev, curr) => prev.concat(curr.features || []), [])
	// Filter features by certain criteria
	.filter(feature => {
		return feature.geometry.type === 'Point' &&
			feature.properties.id === 'EONET_5104';
	})
	// Create custom feature points
	.map(feature => {
		return {
			type: "Feature",
			geometry: feature.geometry,
			properties: feature.properties
		};
	});
// Sort event points by date
eventFeatures.sort((a, b) => a.properties.date > b.properties.date);
// Record the first and last events
const firstEvent = eventFeatures[0];
const lastEvent = eventFeatures[eventFeatures.length - 1];
// Log information about the selected events
console.info("Number of selected events: " + eventFeatures.length);
console.info("Event started at: " + firstEvent.properties.date);
console.info("Event ended at: " + lastEvent.properties.date);
// Color code the start and end events
firstEvent.properties.style = { fillColor: '#53d453' }; // Green
lastEvent.properties.style = { fillColor: '#ea6868' }; // Red
// Build the event path line string
const eventPath = eventFeatures.map(f => f.geometry.coordinates);
// Add a new GeoJSON layer for the event path
eventFeatures.unshift({
	type: "LineString",
	coordinates: eventPath
});
// Return the layer to display it on the map
return {
	type: 'FeatureCollection',
	features: eventFeatures
};
`;
	sourceCode.val(exampleScript);
}
function loadExample ( ) { loadGeoJSONInput ( 'eonet_test_data.json' ) ; $ ( '#layerUrl' ) . val ( 'eonet_test_data_2.json' ) ; const exampleScript = ` ` ; sourceCode . val ( exampleScript ) ; }
Load example data into the UI
Load example data into the UI
// Load example input data // Prefill the URL input field /**
	 * Define the example script.
	 *
	 * Note that the indentation has been adjusted to maintain proper
	 * formatting in the UI.
	 */ // Prefill the script