<commit_before>function measure(latitudeA, longitudeA, latitudeB, longitudeB) {
	// generally used geo measurement function
    var R = 6378.137; // Radius of earth in KM
    var dLat = (latitudeB - latitudeA) * Math.PI / 180;
    var dLon = (longitudeB - longitudeA) * Math.PI / 180;
    var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(latitudeA * Math.PI / 180) * Math.cos(latitudeB * Math.PI / 180) * Math.sin(dLon/2) * Math.sin(dLon/2);
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
    var d = R * c;
    
    return d * 1000; // meters
}

function formatGeoJson(result) {
	return {
		"type": "FeatureCollection",
		"features": [
			{
				"type": "Feature",
				"geometry": {
					"type": "Point",
					"coordinates": [result.longitude, result.latitude]
				},
				"properties": {
					"name": result.zhName,
					"summary": result.summmary
				}
			}
		]
	}
};

var results = [];

module.exports = function(request, response) {
	new Promise(function(resolve) {
		if(!results.length) {
			var model = new AV.Query('Place');
			model.addAscending('order');
			model.find({
				success : function(records) {
					results = records;
					resolve();
				}
			});
		} else {
			resolve();
		}
	}).then(function() {
		return response.success(library.stdReturn(formatGeoJson(results[request.params.index]._serverData)));
	});
};<commit_msg>close to update with new dataset<commit_after>function getDistanceBetweenPoints(latitudeA, longitudeA, latitudeB, longitudeB) {
	// generally used geo measurement function
    var R = 6378.137; // Radius of earth in KM
    var dLat = (latitudeB - latitudeA) * Math.PI / 180;
    var dLon = (longitudeB - longitudeA) * Math.PI / 180;
    var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(latitudeA * Math.PI / 180) * Math.cos(latitudeB * Math.PI / 180) * Math.sin(dLon/2) * Math.sin(dLon/2);
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
    var d = R * c;
    
    return d * 1000; // meters
}

function formatGeoJson() {
	return arguments.length ? {
		"type": "FeatureCollection",
		"features": Array.prototype.slice.call(arguments)
	} : false;
}

function formatOneFeature(result) {
	return {
		"type": "Feature",
		"geometry": {
			"type": "Point",
			"coordinates": [result.longitude, result.latitude]
		},
		"properties": {
			"name": result.name,
			"summary": result.summmary,
			"tags": result.tag
		}		
	};
}

var results = [];

module.exports = function(request, response) {
	var model = new AV.Query('Spot');

	model.find({
		success : function(records) {
			var formatter = records.reduce(function(formatter, record) {
				return formatter.bind(null, formatOneFeature(record._serverData));
			}, formatGeoJson);

			return response.success(library.stdReturn(formatter()));
		}
	});
};
{'fraction_non_alphanumeric': 0.1631768953068592, 'fraction_numerical': 0.021660649819494584, 'mean_word_length': 3.2961240310077518, 'pattern_counts': {'":': 19, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2734970', 'n_tokens_mistral': 1123, 'n_tokens_neox': 960, 'n_words': 207}