Skip to content

Commit 659cb8b

Browse files
authored
Fixes for 0.1 (#125)
1 parent 64228d2 commit 659cb8b

File tree

9 files changed

+48
-22
lines changed

9 files changed

+48
-22
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
## [0.1.0] - 2023-10-17
4+
5+
- Initial public release.
6+
- Initial support for `ScatterplotLayer`, `PathLayer`, and `SolidPolygonLayer`.

DEVELOP.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,4 @@ The documentation website is generated with `mkdocs` and [`mkdocs-material`](htt
7272
poetry run mkdocs serve
7373
```
7474

75-
and you can publish the docs to Github Pages with
76-
77-
```
78-
poetry run mkdocs gh-deploy
79-
```
75+
Publishing documentation happens automatically via CI when a PR is merged.

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,23 @@ Python library for extremely fast geospatial vector data visualization in Jupyte
2020
## Install
2121

2222
```
23-
pip install --pre lonboard
23+
pip install lonboard
2424
```
2525

26+
## Get Started
27+
28+
For the simplest rendering, pass geospatial data into the top-level [`viz` function](https://developmentseed.org/lonboard/api/top-level/#lonboard.viz.viz).
29+
30+
```py
31+
import geopandas as gpd
32+
from lonboard import viz
33+
34+
gdf = gpd.GeoDataFrame(...)
35+
viz(gdf)
36+
```
37+
38+
Under the hood, this delegates to a `ScatterplotLayer`, `PathLayer`, or `SolidPolygonLayer`. Refer to the [documentation](https://developmentseed.org/lonboard/) and [examples](https://developmentseed.org/lonboard/examples/internet-speeds/) for more control over rendering.
39+
2640
## Documentation
2741

2842
Refer to the documentation at [developmentseed.org/lonboard](https://developmentseed.org/lonboard/).

lonboard/serialization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
DEFAULT_PARQUET_COMPRESSION_LEVEL = 7
1212
DEFAULT_PARQUET_CHUNK_SIZE = 2**16
1313
# Target chunk size for Arrow (uncompressed) per Parquet chunk
14-
DEFAULT_ARROW_CHUNK_BYTES_SIZE = 10 * 1024 * 1024 # 10MB
14+
DEFAULT_ARROW_CHUNK_BYTES_SIZE = 5 * 1024 * 1024 # 5MB
1515

1616

1717
def serialize_table_to_parquet(

lonboard/traits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class ColorAccessor(traitlets.TraitType):
7474
_description_
7575
"""
7676

77-
default_value = (255, 255, 255)
77+
default_value = (0, 0, 0)
7878
info_text = (
7979
"a tuple or list representing an RGB(A) color or numpy ndarray or "
8080
"pyarrow FixedSizeList representing an array of RGB(A) colors"

lonboard/viz.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
import pyarrow as pa
1111
import pyarrow.compute as pc
1212
import shapely.geometry
13+
import shapely.geometry.base
1314
from numpy.typing import NDArray
1415

1516
from lonboard.constants import EPSG_4326, EXTENSION_NAME, OGC_84
1617
from lonboard.geoarrow.extension_types import construct_geometry_array
1718
from lonboard.geoarrow.geopandas_interop import geopandas_to_geoarrow
18-
from lonboard.layer import BaseLayer, PathLayer, ScatterplotLayer, SolidPolygonLayer
19+
from lonboard.layer import PathLayer, ScatterplotLayer, SolidPolygonLayer
1920

2021
if TYPE_CHECKING:
2122
import geopandas as gpd
@@ -116,8 +117,9 @@ def viz(
116117
raise ValueError
117118

118119

119-
# TODO: check CRS in geopandas methods
120-
def _viz_geopandas_geodataframe(data: gpd.GeoDataFrame, **kwargs) -> BaseLayer:
120+
def _viz_geopandas_geodataframe(
121+
data: gpd.GeoDataFrame, **kwargs
122+
) -> Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]:
121123
if data.crs and data.crs not in [EPSG_4326, OGC_84]:
122124
warnings.warn("GeoDataFrame being reprojected to EPSG:4326")
123125
data = data.to_crs(OGC_84)
@@ -126,7 +128,9 @@ def _viz_geopandas_geodataframe(data: gpd.GeoDataFrame, **kwargs) -> BaseLayer:
126128
return _viz_geoarrow_table(table, **kwargs)
127129

128130

129-
def _viz_geopandas_geoseries(data: gpd.GeoSeries, **kwargs) -> BaseLayer:
131+
def _viz_geopandas_geoseries(
132+
data: gpd.GeoSeries, **kwargs
133+
) -> Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]:
130134
import geopandas as gpd
131135

132136
if data.crs and data.crs not in [EPSG_4326, OGC_84]:
@@ -140,19 +144,23 @@ def _viz_geopandas_geoseries(data: gpd.GeoSeries, **kwargs) -> BaseLayer:
140144

141145
def _viz_shapely_scalar(
142146
data: shapely.geometry.base.BaseGeometry, **kwargs
143-
) -> BaseLayer:
147+
) -> Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]:
144148
return _viz_shapely_array(np.array([data]), **kwargs)
145149

146150

147-
def _viz_shapely_array(data: NDArray[np.object_], **kwargs) -> BaseLayer:
151+
def _viz_shapely_array(
152+
data: NDArray[np.object_], **kwargs
153+
) -> Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]:
148154
# TODO: pass include_z?
149155
field, geom_arr = construct_geometry_array(data)
150156
schema = pa.schema([field])
151157
table = pa.Table.from_arrays([geom_arr], schema=schema)
152158
return _viz_geoarrow_table(table, **kwargs)
153159

154160

155-
def _viz_geo_interface(data: dict, **kwargs) -> BaseLayer:
161+
def _viz_geo_interface(
162+
data: dict, **kwargs
163+
) -> Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]:
156164
if data["type"] in [
157165
"Point",
158166
"LineString",
@@ -193,21 +201,23 @@ def _viz_geo_interface(data: dict, **kwargs) -> BaseLayer:
193201
raise ValueError(f"type '{geo_interface_type}' not supported.")
194202

195203

196-
def _viz_geoarrow_table(table: pa.Table, **kwargs) -> BaseLayer:
204+
def _viz_geoarrow_table(
205+
table: pa.Table, **kwargs
206+
) -> Union[ScatterplotLayer, PathLayer, SolidPolygonLayer]:
197207
geometry_ext_type = table.schema.field("geometry").metadata.get(
198208
b"ARROW:extension:name"
199209
)
200210

201211
if geometry_ext_type in [EXTENSION_NAME.POINT, EXTENSION_NAME.MULTIPOINT]:
202-
return ScatterplotLayer(table, **kwargs)
212+
return ScatterplotLayer(table=table, **kwargs)
203213

204214
elif geometry_ext_type in [
205215
EXTENSION_NAME.LINESTRING,
206216
EXTENSION_NAME.MULTILINESTRING,
207217
]:
208-
return PathLayer(table, **kwargs)
218+
return PathLayer(table=table, **kwargs)
209219

210220
elif geometry_ext_type in [EXTENSION_NAME.POLYGON, EXTENSION_NAME.MULTIPOLYGON]:
211-
return SolidPolygonLayer(table, **kwargs)
221+
return SolidPolygonLayer(table=table, **kwargs)
212222

213223
raise ValueError(f"Unsupported extension type: '{geometry_ext_type}'.")

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"@deck.gl/core": "^8.9.30",
66
"@deck.gl/layers": "^8.9.30",
77
"@deck.gl/react": "^8.9.30",
8-
"@geoarrow/deck.gl-layers": "^0.1.0-beta.5",
8+
"@geoarrow/deck.gl-layers": "^0.1.0",
99
"apache-arrow": "^13.0.0",
1010
"maplibre-gl": "^3.5.0",
1111
"parquet-wasm": "0.5.0-alpha.1",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "lonboard"
3-
version = "0.1.0-beta.7"
3+
version = "0.1.0"
44
description = "Extremely fast geospatial data visualization in Python."
55
authors = ["Kyle Barron <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)