Code Monkey home page Code Monkey logo

Comments (8)

shriv avatar shriv commented on June 23, 2024 1

Got a lonboard map running within quarto!

# this was needed because I'm using poetry within a nix environment
export QUARTO_PYTHON=$(which python)
# render the qmd file to html
quarto render test.qmd

However, it is a bit slow for all the links in the full country so I'm going to move the project to a shiny app.

image

from lonboard.

shriv avatar shriv commented on June 23, 2024 1

@arthurgailes I just had the following in test.qmd before I ran quarto render test.qmd. I've put a \ before the triple backticks so that you can see all the contents in one snippet rather than multiple! :-) The \ won't be there in the actual qmd file..

---
title: "Lonboard test"
execute:
  echo: false
format: 
  html: 
    self-contained: true
jupyter: python3
---

\```{python}
# importing packages
import pandas as pd
import geopandas as gpd
import lonboard
from IPython.display import display, HTML

# geopandas option
gpd.options.io_engine = "pyogrio"
\```


\```{python}
network = gpd.read_file("data/network.gpkg")
car_vols = pd.read_csv("data/volumes_car_hourly.csv")
# join volume data to network
network_vols = network.merge(car_vols)
\```

\```{python}
layer = lonboard.PathLayer.from_geopandas(
    network_vols,
    width_min_pixels=0.8)
map_ = lonboard.Map(layers=[layer])
map_
\```


from lonboard.

arthurgailes avatar arthurgailes commented on June 23, 2024 1

@shriv that works, thank you very much.

from lonboard.

kylebarron avatar kylebarron commented on June 23, 2024

I'm not familiar with using quarto in this way. Does to_html do what you want? That saves the HTML as a file on disk. Or do you want to render the HTML with IPython as a static HTML?

from lonboard.

shriv avatar shriv commented on June 23, 2024

The latter. I normally render the quarto document within a single html. The rendering engine for python in quarto is Jupyter and I can even render a ipynb file with quarto.. Maybe it will all be fine! Apologies, I normally use R with quarto and I haven't used it as extensively with python. I'll have a bit of a tinker and write back here :-)

from lonboard.

kylebarron avatar kylebarron commented on June 23, 2024

You can try using IPython.display.core.HTML() like I do in this PR #474

from lonboard.

shriv avatar shriv commented on June 23, 2024

Many thanks @kylebarron..! I will try that as well 👍

from lonboard.

arthurgailes avatar arthurgailes commented on June 23, 2024

@shriv how did you get quarto to output the HTML properly?

from lonboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.