2 years ago
#70721
hello543
Python Bokeh iterate over lat/lgn list and Geomap plot them
I have a list of random lat and lng values:
values_list = [['54.866451477248', '14.960403166572'],
['54.864632875802', '14.961946867018'],
['54.954669039256', '14.948996004456'],
['55.062464907296', '14.942403568565'],
['54.8500632', '14.8440791'],
['55.4865391', '14.4950162'],
['55.136166', '14.007264'],
['55.333691003583', '14.76279273417'],
['54.931334101644', '14.881326183346']]
I would like to loop through these coordinates and plot all of them on a bokeh geo map, managed to do it for one lat/lgn pair, but would like to make a function that would loop through all of those coordinates and plot them all on an map.
from pyproj import Transformer
transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
lat, lgn = transformer.transform('values_list[0][0],values_list[0][0]) # transform the cooradinates
from bokeh.tile_providers import get_provider, Vendors
#tile_provider = get_provider(Vendors.CARTODBPOSITRON)
tile_provider = get_provider(Vendors.STAMEN_TONER_BACKGROUND)
# range bounds supplied in web mercator coordinates
m = figure(plot_width=800,
plot_height=400,
x_range=(-1000000, 5000000),
y_range=(4800000, 5000000),
x_axis_type='mercator',
y_axis_type='mercator')
m.add_tile(tile_provider)
m.circle(x=lat, y=lgn, size=10, color='red')
show(m)
THank you!
python
bokeh
0 Answers
Your Answer