output of geoparser gives locations with a latitude and longitude of the center of each place

coordinate grids

coordinate systems split the world up into 360 degrees of longitude (from 180° West to 180° East), and 180 degrees of latitude (from 90° South to 90° North). can be set up a grid like this with cells of a given size in degrees with numpy:

import numpy as np
def generate_grid_df(degrees):
    LON = np.linspace(-180+degrees*0.5,180-degrees*0.5,int(360/degrees))
    LAT = np.linspace(-90+degrees*0.5,90-degrees*0.5,int(180/degrees))
    lon_df, lat_df = np.meshgrid(LON,LAT)

    return pd.DataFrame({"LAT": lat_df.ravel(), "LON": lon_df.ravel()})
    
grid_df = generate_grid_df(2.5)
grid_df.head()

to check → merge with some other gridded data and plot

example:

Untitled

Shapefiles

to bridge between places and grid cells → get shape files that will give polygons for geographical entities

→ shapefiles from natural earth have different feature classes to the geographical entities in our dataset (used diff dictionary to map to the shapefile classes)