I am working with QGIS 3.4.8 and Python 3.6.8 on OSX El Capitan 10.11.6.
I have two shapefilea, one which is a grid of cells (each cell a feature) and the other one which is urban settlements as reported by Columbia's SEDAC project (green features in picture).
I wish to calculate the area that is urban in each cell, but I have the problem of urban settlements crossing between cell (like the yellow shown in picture) and also of cells with multiple urban settlements. I have not been able to find out a proper way to get around it.
Similarly, I have a map of Africa with country divisions and my cell grid. I wish to attribute a country to each cell, but some cells cross borders.
One way to get around it is to use centroids, which actually is an arbitrary measure and makes me lose some near-the-ocean cells, which could be negligible but I would like to make an effort to recover. I was thinking that maybe calculating the area of a country in a cell and attributing to the country with higher area the country of the cell would be somehow more rigorous. However, I have not been able to figure how can I possible do that.