GeoJSON Lines
Draw Manhattan road polylines from GeoJSON with custom line styling and opacity.
Python Script
python
"""Lines — Manhattan roads as a polylines layer (gallery: geojson-lines-vis)."""
from __future__ import annotations
from pathlib import Path
import pyautark as ak
DATA_DIR = Path(__file__).resolve().parents[1] / "data"
roads = ak.GeoJSON("roads", url=(DATA_DIR / "mnt_roads.geojson").as_uri())
spec = ak.Spec(
metadata=ak.Metadata(title="GeoJSON Lines — Manhattan Roads"),
data=[roads],
views=[ak.Map(layers=[ak.Layer(roads, id="roads").style(color="#5c6bc0", width=12, opacity=0.85)])],
)
if __name__ == "__main__":
spec.window(height="760px")Run in Jupyter or standalone HTML
Replace spec.window(...) with spec.widget() inside a Jupyter notebook (requires pip install "pyautark[widget]") or spec.save_html("out.html") to export a standalone web page.
This example comes from the pyautark repository.