Hello all,
The main question: at the moment, is it basically possible to use “folium.Choropleth” without any trouble.
Folium alone does not cause any problems,
MAP_LOC = [48.88774545, 10.092337] # here Ostalbkreis
map_kreisverband = folium.Map(
location=MAP_LOC,
zoom_start=11,
#tiles = ‘Stamen Terrain’,
width=“100%” ,
height=“100%”
)
folium.TileLayer(
name=“county”,
control=True,
).add_to(map_kreisverband)
map_kreisverband
outputs a nice map.
I open the files as follows:
from pyodide.http import open_url ## Get the data
#------ Daten --------------------------------------------------
DATA_URL_JSON = (“Daten\kv-csv\json\kv_ellwangen_aalen.geojson”)
DATA_URL_DF = (“Daten\kv-csv\kv-mitglieder-summe-final-copy.csv”)
DATA_URL_DF_KV = (“Daten\kv-csv\kv-mitglieder-lat-lon.csv”)
url_content_json = open_url(DATA_URL_JSON)
url_content_df = open_url(DATA_URL_DF)
url_content_df_kv = open_url(DATA_URL_DF_KV)
df = pd.read_csv(url_content_df)
df_kv =pd.read_csv(url_content_df_kv)
If I include the GEOJSON file,
MAP_LOC = [48.88774545, 10.092337] # in this case Ostalbkreis
map_kreisverband = folium.Map(
location=MAP_LOC,
zoom_start=11,
#tiles = ‘Stamen Terrain’,
width=“100%” ,
height=“100%”
)
folium.TileLayer(
name=“county”,
control=True,
).add_to(map_kreisverband)
folium.Choropleth(
geo_data=url_content_json, #<----- the JSON/GEOJSON-File
name=“Anzeige nach Mitglieder je Ort”, #Ostalbkreis Daten
key_on=“feature.properties.GEN”,
data=df,
columns=[“GEN”, “members”],
.
.
.
.
I get the error:
logger.ts:39 [pyscript/base] PythonError: Traceback (most recent call last):
File “/lib/python3.10/asyncio/futures.py”, line 201, in result
raise self._exception
File “/lib/python3.10/asyncio/tasks.py”, line 232, in __step
result = coro.send(None)
File “/lib/python3.10/site-packages/_pyodide/_base.py”, line 506, in eval_code_async
await CodeRunner(
File “/lib/python3.10/site-packages/_pyodide/_base.py”, line 357, in run_async
coroutine = eval(self.code, globals, locals)
File “”, line 38, in
File “/lib/python3.10/site-packages/folium/features.py”, line 1290, in init
self.geojson = GeoJson(
File “/lib/python3.10/site-packages/folium/features.py”, line 497, in init
self.data = self.process_data(data)
File “/lib/python3.10/site-packages/folium/features.py”, line 542, in process_data
raise ValueError(‘Cannot render objects with any missing geometries’
ValueError: Cannot render objects with any missing geometries: <_io.StringIO object at 0x2da3fb0>
As a normal Python script the program runs without errors.
I hope I could make my problem understandable.
Greetings
Walter