I am working on the Folium Map Python Library, and Its connects the two different points together (PolyLine), is there any best example with folium which doesn't connect lines on map or I can color them with unique ids,
I was trying some JSON thing with my Data, but that didn't work with my code, still it connects all the different lines as mentioned in below picture? can any one suggest any best solution, which doesn't connect these lines, but I have to still use the folium.
lat = filteredData.lat
lon = filteredData.lon
data = {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[lon, lat] for (lat, lon) in zip(lat, lon)],
},
'properties': {'fillcolor': 'black'}
},
],
}
m = folium.Map(location=[36.862317, -76.3151], zoom_start=6)
m.add_child(folium.features.GeoJson(data))
m
Most likely the problem arises because you have only one feature in the geojson definition. You should be doing something like this:
data = {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[lon, lat] for lat, lon in zip(lats, lons)],
},
'properties': {'fillcolor': 'black'}
}
for (lats, lons) in zip(latss, lonss)],
}
Here both lats
and lons
are lists of numbers. Hence, latss
and lonss
are lists of lists of numbers. Each pair (lats, lons)
describes a single line.