Skip to content

Problem with Folium search plugin (loading Geojosn Data) #1125

@morteza3000

Description

@morteza3000

Please add a code sample or a nbviewer link, copy-pastable if possible

import folium
from folium import plugins

points = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "one"
},
"geometry": {
"type": "Point",
"coordinates": [-71.0636, 42.3581]
}
},
{
"type": "Feature",
"properties": {
"name": "two"
},
"geometry": {
"type": "Point",
"coordinates": [-74.78991444, 42.82995815]
}
},
{
"type": "Feature",
"properties": {
"name": "three"
},
"geometry": {
"type": "Point",
"coordinates": [-78.56603306, 39.17929819]
}
}
]
}

m = folium.Map(
location=[42.82995815, -74.78991444],
tiles = 'cartodbpositron',
zoom_start=4
)

plugins.Search(points, search_zoom=20, ).add_to(m)

m.save('example.html')

Problem description

I'm facing with below error when running above code.
AssertionError: Search can only index FeatureGroup, MarkerCluster, GeoJson, and TopoJson layers at this time.

Expected Output

Output of folium.__version__

0.8.3

@Conengmo
@ghandic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions