bin/loadTweets.js
//Return the state name of GeoJSON point
Return the state name of GeoJSON point
Return the state name of GeoJSON point
function findState(country,tweetGeoJson) {
	tweetGeoJson.properties.country="Not Found";
	for (var i = 0; i < state.features.length; i++) {
		if (tweetGeoJson.geometry.coordinates[0] >= state.features[i].bbox[0] &&
			tweetGeoJson.geometry.coordinates[0] <= state.features[i].bbox[2] &&
			tweetGeoJson.geometry.coordinates[1] >= state.features[i].bbox[1] &&
			tweetGeoJson.geometry.coordinates[1] <= state.features[i].bbox[3]) {
			if (turf.inside(tweetGeoJson, state.features[i])) {
				tweetGeoJson.properties.state=state.features[i].properties.name;
				tweetGeoJson.properties.country=state.features[i].properties.admin;
				return;
			} 
		}
	}
	tweetGeoJson.properties.state='Not Found';
	return;
}
function findState ( country , tweetGeoJson ) { tweetGeoJson . properties . country = "Not Found" ; for ( var i = 0 ; i < state . features . length ; i ++ ) { if ( tweetGeoJson . geometry . coordinates [ 0 ] >= state . features [ i ] . bbox [ 0 ] && tweetGeoJson . geometry . coordinates [ 0 ] <= state . features [ i ] . bbox [ 2 ] && tweetGeoJson . geometry . coordinates [ 1 ] >= state . features [ i ] . bbox [ 1 ] && tweetGeoJson . geometry . coordinates [ 1 ] <= state . features [ i ] . bbox [ 3 ] ) { if ( turf . inside ( tweetGeoJson , state . features [ i ] ) ) { tweetGeoJson . properties . state = state . features [ i ] . properties . name ; tweetGeoJson . properties . country = state . features [ i ] . properties . admin ; return ; } } } tweetGeoJson . properties . state = 'Not Found' ; return ; }
Return the state name of GeoJSON point
Return the state name of GeoJSON point
//Point inside country boundaries