I am currently trying to get the drive network of Continental Portugal, which is a Polygon. However kernel on the last line of code crashes. In the ubuntu terminal it says; 'Created graph with 4,901,116 nodes and 9,503,596 edges in 101.64 seconds', seconds later kernel gives me the following message: 'Kernel Restarting The kernel for Desktop/osmnx_project.ipynb appears to have died. It will restart automatically'
import geopandas as gpd
import pandas as pd
from shapely.geometry import Point, LineString, Polygon
import networkx as nx
import osmnx as ox
import matplotlib.pyplot as plt
from descartes import PolygonPatch
from IPython.display import IFrame
ox.config(log_console=True, use_cache=True)
place = 'Portugal'
G = ox.gdf_from_place(place)
exploded_G = G.explode()
exploded_G['area'] = exploded_G.area
exploded_G.sort_values(by='area', inplace=True)
Portugal= exploded_G.iloc[-1]['geometry']
g = ox.graph_from_polygon(polygon = Portugal, network_type = 'drive')
Can anyone help me figure out exactly what is wrong or if there is a way to simplify my code in order to be lighter and faster. I suspect it could be a RAM issue, but my computer has 16GB of RAM
Thank you in advance.