Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TripsLayer for animating moving objects and connect to MovingPandas #292

Merged
merged 50 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c582438
bump deck version
kylebarron Dec 5, 2023
1bd1ad3
Add trips layer
kylebarron Dec 5, 2023
8075fbb
Add movingpandas import
kylebarron Dec 5, 2023
8e5a479
Merge branch 'main' into kyle/trips-layer
kylebarron Mar 25, 2024
96ac30b
update lockfile
kylebarron Mar 25, 2024
acaaddb
Restore TimestampAccessor trait
kylebarron Mar 25, 2024
daae1b4
fmt
kylebarron Mar 25, 2024
702a853
Merge branch 'main' into kyle/trips-layer
kylebarron Sep 19, 2024
159ff0b
Use isDefined on the model
kylebarron Sep 19, 2024
d3154b6
Add dev dep
kylebarron Sep 19, 2024
0fb89c4
Update trips layer
kylebarron Sep 19, 2024
72e0bdb
Unpack typing extensions
kylebarron Sep 19, 2024
c707aad
Update timestamp accessor trait
kylebarron Sep 19, 2024
7247452
fix default parameters
kylebarron Sep 19, 2024
fa65b87
fix test
kylebarron Sep 19, 2024
1ced621
Implement generic MovingPandas to GeoArrow
kylebarron Sep 22, 2024
fff32f6
Update lonboard/_geoarrow/movingpandas_interop.py
kylebarron Sep 23, 2024
0dcf3fe
lint
kylebarron Sep 23, 2024
a4bc5b9
fix timestamp type
kylebarron Sep 23, 2024
dd56ef3
Handle timezone in timestamp dtype
kylebarron Sep 23, 2024
9944c66
Merge branch 'main' into kyle/trips-layer
kylebarron Sep 25, 2024
b32939d
trait updates for timestamp accessor
kylebarron Sep 25, 2024
ca9dcd1
Manage precision reduction
kylebarron Sep 27, 2024
37a64c6
Validate list offsets
kylebarron Sep 27, 2024
6addb2e
Store min timestamp on the layer trait
kylebarron Sep 27, 2024
b346810
Add custom timestamp accessor serialization
kylebarron Sep 27, 2024
b08965a
Add trips layer to docs
kylebarron Sep 30, 2024
d2a5202
Update layer docs
kylebarron Sep 30, 2024
150c46b
Update arro3
kylebarron Sep 30, 2024
b94194a
Add ship-data example
kylebarron Sep 30, 2024
2bbcd3e
Improved docs
kylebarron Oct 1, 2024
ddb64f8
Update fiona, arro3
kylebarron Oct 1, 2024
9391062
Mapping back to real time
kylebarron Oct 1, 2024
3297403
wip
kylebarron Oct 2, 2024
6cca53a
Merge branch 'main' into kyle/trips-layer
kylebarron Oct 3, 2024
28938c8
update lockfile
kylebarron Oct 3, 2024
837bb1d
fix import
kylebarron Oct 3, 2024
49b20fc
Fix test
kylebarron Oct 3, 2024
7d262bf
Merge branch 'main' into kyle/trips-layer
kylebarron Oct 4, 2024
4b0ee7b
WIP: air traffic control example
kylebarron Oct 4, 2024
61c5923
Add from_geopandas and from_duckdb methods to TripsLayer
kylebarron Oct 7, 2024
e859ce1
Bump arro3 to 0.4.1
kylebarron Oct 7, 2024
5a026eb
Change interval to fps
kylebarron Oct 7, 2024
3e75895
Change top-level description
kylebarron Oct 7, 2024
79cc520
Update air traffic control notebook
kylebarron Oct 7, 2024
186c419
Update animate
kylebarron Oct 7, 2024
c790753
print tz info
kylebarron Oct 7, 2024
b64b330
Updated ship data example
kylebarron Oct 7, 2024
7f59af9
Add gif to atc notebook
kylebarron Oct 7, 2024
5247af0
Add examples to docs
kylebarron Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/api/layers/trips-layer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# TripsLayer

::: lonboard.experimental.TripsLayer
options:
inherited_members: true
1 change: 1 addition & 0 deletions docs/api/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
::: lonboard.traits.NormalAccessor
::: lonboard.traits.PointAccessor
::: lonboard.traits.ArrowTableTrait
::: lonboard.experimental.traits.TimestampAccessor
306 changes: 306 additions & 0 deletions examples/air-traffic-control.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from io import BytesIO\n",
"\n",
"import pyarrow as pa\n",
"import pyarrow.parquet as pq\n",
"import requests\n",
"\n",
"import lonboard\n",
"from lonboard.experimental import TripsLayer\n",
"from lonboard import Map\n",
"import arro3.core"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'0.5.0-beta.2'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arro3.core.__version__"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"url = \"https://github.com/kylebarron/adsb-extract/releases/download/v0.1/2024-10-03_traces.parquet\""
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"r = requests.get(url)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"table = pq.read_table(BytesIO(r.content))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"timestamps = table[\"timestamp\"]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/kyle/github/developmentseed/lonboard/lonboard/_geoarrow/ops/reproject.py:33: UserWarning: No CRS exists on data. If no data is shown on the map, double check that your CRS is WGS84.\n",
" warn(\n",
"/Users/kyle/github/developmentseed/lonboard/lonboard/experimental/traits.py:146: UserWarning: Reducing precision of input timestamp data to 's' to fit into available GPU precision.\n",
" warnings.warn(\n"
]
}
],
"source": [
"layer = TripsLayer(table=table, get_timestamps=table[\"timestamp\"])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"m = Map(layer)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a1794393a04d49ec84606b857dc3e6da",
"version_major": 2,
"version_minor": 1
},
"text/plain": [
"Map(custom_attribution='', layers=(TripsLayer(get_timestamps=arro3.core.ChunkedArray<List(Field { name: \"\", da…"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"from datetime import timedelta"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6ee7b44ce46543d48e343af6fcdb3243",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Play(value=-16777216, interval=16, max=-16690817, min=-16777216, repeat=True, step=120)"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"layer.animate(step=timedelta(minutes=2), interval=1000/60)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"layer.stop_animation()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"layer.width_min_pixels = 3"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"layer.get_color = [30, 30, 200, 200]"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"layer.trail_length = 1000"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-16748736.0"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"layer.current_time"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"m._height = 800"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"arro3.core.Table\n",
"-----------\n",
"geometry: List(Field { name: \"element\", data_type: FixedSizeList(Field { name: \"element\", data_type: Float64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, 3), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })\n",
"timestamp: List(Field { name: \"element\", data_type: Timestamp(Millisecond, Some(\"UTC\")), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })\n",
"ground_speed: List(Field { name: \"element\", data_type: Float32, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })\n",
"heading: List(Field { name: \"element\", data_type: Float32, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })\n",
"vertical_speed: List(Field { name: \"element\", data_type: Float32, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} })\n",
"icao_id: Utf8"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"layer.table"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"arro3.core.ChunkedArray<List(Field { name: \"\", data_type: Timestamp(Second, Some(\"UTC\")), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} })>"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"layer.get_timestamps"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "lonboard",
"language": "python",
"name": "lonboard"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading