bin/loadTweets.js
//Return the country name of GeoJSON point
Return the country name of GeoJSON point
Return the country name of GeoJSON point
function findCountry(tweetGeoJson) {
	var near = '';
	var distance=99999;
	for (var i = 0; i < geo.features.length; i++) {
		if (tweetGeoJson.geometry.coordinates[0] >= geo.features[i].bbox[0] &&
			tweetGeoJson.geometry.coordinates[0] <= geo.features[i].bbox[2] &&
			tweetGeoJson.geometry.coordinates[1] >= geo.features[i].bbox[1] &&
			tweetGeoJson.geometry.coordinates[1] <= geo.features[i].bbox[3]) {
			if (turf.inside(tweetGeoJson, geo.features[i])) {
				return geo.features[i].properties.ADMIN;
			} else {
				if (near != '') {
				}
				near = geo.features[i].properties.ADMIN;
			}
		}
	}
	if (near != '') {
		return near;
	} else {
		return 'Not Found';
	}
}
function findCountry ( tweetGeoJson ) { var near = '' ; var distance = 99999 ; for ( var i = 0 ; i < geo . features . length ; i ++ ) { if ( tweetGeoJson . geometry . coordinates [ 0 ] >= geo . features [ i ] . bbox [ 0 ] && tweetGeoJson . geometry . coordinates [ 0 ] <= geo . features [ i ] . bbox [ 2 ] && tweetGeoJson . geometry . coordinates [ 1 ] >= geo . features [ i ] . bbox [ 1 ] && tweetGeoJson . geometry . coordinates [ 1 ] <= geo . features [ i ] . bbox [ 3 ] ) { if ( turf . inside ( tweetGeoJson , geo . features [ i ] ) ) { return geo . features [ i ] . properties . ADMIN ; } else { if ( near != '' ) { } near = geo . features [ i ] . properties . ADMIN ; } } } if ( near != '' ) { return near ; } else { return 'Not Found' ; } }
Return the country name of GeoJSON point
Return the country name of GeoJSON point
//Point inside country boundaries //console.error(lines + ': near match with- ' + near + ' and ' + geo.features[i].properties.ADMIN); //console.log('Using last near match: '+near);