I think you want to make a path planning using OccupancyGrid,
the data types defined in this message type are ;
# This represents a 2-D grid map, in which each cell represents the probability of
# occupancy.
Header header
#MetaData for the map
MapMetaData info
# The map data, in row-major order, starting with (0,0). Occupancy
# probabilities are in the range [0,100]. Unknown is -1.
int8[] data
data
array indicates whether a cell is occupied or not,. Note that this is a 1D array which you need to think/convert it to 2D.
You can get x,y position of each cell using meta data of map inside info
for example;
void YourClass::QueryMapCellInfo(const nav_msgs::OccupancyGridConstPtr &grid){
for(int i=0; i<grid->info.height; i++){
for(int j =0; j<grid->info.width; j++){
int current_cell_value = grid->data[i+ (grid->info.width * j)];
// do some processing according to cell value you got
}
}
}