You can filter your geoJson data down to the grid cell you need using logic like this:
It isn't working however, because the sample mouse position you included isn't in either of these cells. The lon that you provided (-74.5055) is smaller than the minimum in cell 22 (-74.505793)
var geojsonArray = [{
"Grid Cell Number": 21,
"Grid Cell State": "NJ",
"Grid Cell Name": "Grid26_2",
"Grid Cell Area SqMi": 2.39808504259641,
"Grid Cell Centroid Longitude": -74.5457211209226,
"Grid Cell Centroid Latitude": 41.2799557125122,
"Grid Cell Start Point Longitude": -74.523164,
"Grid Cell Start Point Latitude": 41.278898,
"Grid Cell End Point Longitude": -74.525255,
"Grid Cell End Point Latitude": 41.279889,
"Event Name": "Superstorm Sandy NY",
"NOAA Tidal Gage Station ID": "8518750",
"Max_NOAA_Tidal_Gage_Water_Level_ft_MSL": "11.49",
"Oldest Tidal Gage Data": "2010-01-01",
"Return Period": "6315.03"
},
{
"Grid Cell Number": 22,
"Grid Cell State": "NJ",
"Grid Cell Name": "Grid27_2",
"Grid Cell Area SqMi": 0.26600197470632,
"Grid Cell Centroid Longitude": -74.5172506948515,
"Grid Cell Centroid Latitude": 41.2733184226687,
"Grid Cell Start Point Longitude": -74.505495,
"Grid Cell Start Point Latitude": 41.270536,
"Grid Cell End Point Longitude": -74.505793,
"Grid Cell End Point Latitude": 41.270684,
"Event Name": "Superstorm Sandy NY",
"NOAA Tidal Gage Station ID": "8518750",
"Max_NOAA_Tidal_Gage_Water_Level_ft_MSL": "11.49",
"Oldest Tidal Gage Data": "2010-01-01",
"Return Period": "6315.03"
}
];
var mouse = {
lat: 41.27061,
lon: -74.5055
}
function FindGridCellByMouse(mouse, cells) {
var resultsCells = cells.filter(function (cell) {
var minLat = cell["Grid Cell Start Point Latitude"];
var maxLat = cell["Grid Cell End Point Latitude"];
var minLon = cell["Grid Cell Start Point Longitude"];
var maxLon = cell["Grid Cell End Point Longitude"];
return mouse.lat >= minLat && mouse.lat <= maxLat && mouse.lon >= minLon && mouse.lon <= maxLon;
});
if (resultsCells.length === 1) {
console.log("We found the cell");
return resultsCells[0];
} else if (resultsCells.length > 1) {
console.log("More than 1 cell found.");
return resultsCells;
} else {
console.log("No cell found.");
return null;
}
}
var cell = FindGridCellByMouse(mouse, geojsonArray);
console.log(cell);