Features not displayed with style_function
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 38/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- jupyter-notebook, python
- Domínio
- data-visualization
Direção de pesquisa
Comece executando a reprodução GeoJSON da issue no Jupyter Notebook com e sem style_function, usando os dados demo.json anexados. Rastreie o caminho de estilização do Folium GeoJson e verifique a conclusão quando as features LineString forem renderizadas com a cor, espessura, opacidade e dashArray solicitadas.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
When loading a set of GeoJSON LineString features, they are not displayed on the Folium map in my Jupyter Notebook (GColab, as well) when using style_function. If style_function=style_functions is removed from the following code, the features are displayed correctly, even though without styling.
To Reproduce
import folium
import json
# Load the GeoJSON file
with open('demo.json') as f:
data = json.load(f)
# Create a Folium map centered on a location of your choice
m = folium.Map(location=[37.982759260869564, 23.901986296376812], zoom_start=18)
# Define a style function that changes the color of LineString features
def style_functions(feature):
color = 'red' # Change the color to your desired color or use a custom logic
return {
'color': 'blue',
'weight': 3,
'opacity': 0.7,
'dashArray': [5, 10]
}
# Add the GeoJSON data to the map with the style function applied
folium.GeoJson(data, style_function=style_functions).add_to(m)
# Display the map
m
Demo GeoJSON has been attached. Please remove the .txt extension for it to load.
demo.json.txt
Expected behavior
style_function should not hide the features, but display them with the styling specified.
Environment (please complete the following information):
- Browser [e.g. firefox]
- Jupyter Lab & Google Colab
- Python 3.10.12
- folium 0.14.0
- branca 0.6.0
Additional context
In a similar test, PointString features were correctly displayed, with or without the style_function argument.
- Linguagem predominante
- Python
- Estrelas
- 7.4k
- Forks
- 2.3k
- Merge médio
- 1d 23h
- PRs com merge (30d)
- 11
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python-visualization/folium
-
Allow custom colors in folium.IconTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
python-visualization/folium#2293 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Make it more obvious how to add textTalvez já em andamento @mosessamofficial-sys assumiu há 233 dias. Abertadocumentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
python-visualization/folium#2092 · 5 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
python-visualization/folium#2259 ·
Mantenedores costumam responder em até 1 dia
-
Map output from OSM returns blocked tiles, due to defective request or not following referer-policyAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
python-visualization/folium#2236 · 8 comentários · 2 reações ·
Mantenedores costumam responder em até 1 dia
-
Touch Screen often failsAberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 10/100
python-visualization/folium#2219 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de python-visualization/folium
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
aws-samples/sample-per-model-bedrock#261 ·
Mantenedores costumam responder em até 1 dia
-
[UI/Accessibility] Low contrast text visibility in country selection dropdown on settings pageAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
pwncollege/dojo#1188 ·
Mantenedores costumam responder em até 1 dia
-
bug launcher packaging
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
tenstorrent/tt-studio#1426 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
python-attrs/cattrs#796 ·
Mantenedores costumam responder em até 1 dia