Hey guys, i’m currently receiving data from a shapefile which has +100k LineString’s. My biggest issue is when i try to zoom out/in or even moving the content, it’s extremely slow. It’s most likely due to a big quantity of data.
Is there any way to solve this issue?
from django.shortcuts import render_to_response
from bokeh.plotting import figure
from bokeh.embed import components
from bokeh.models import ColumnDataSource
import geopandas as gpd
import sys
def index(request):
Read file
data= gpd.read_file("./shapefiles/file.shp")
Read coords
data[‘x’] = data.apply(getPolyCoords, geom=‘geometry’, coord_type=‘x’, axis=1)
Point DataSource
source = ColumnDataSource(data.drop(‘geometry’, axis=1).copy())
Plot
plot = figure(x_axis_location=None, y_axis_location=None, sizing_mode = ‘scale_both’)
plot.multi_line(‘x’, ‘y’, source=source, color=‘black’, line_width=1)
#Store components
script, div = components(plot)
#Feed them to the Django template.
return render_to_response( ‘posts/index.html’,
{‘script’ : script , ‘div’ : div} )