Skip to content

Commit

Permalink
Full __geo_interface__ support, test_geojson
Browse files Browse the repository at this point in the history
  • Loading branch information
iliatimofeev committed May 7, 2018
1 parent b627c6c commit 2cd9fde
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 19 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ target/

.ipynb_checkpoints
.idea/*
.vscode/*
tools/_build
Untitled*.ipynb
.mypy*
Expand Down
Binary file removed altair/.DS_Store
Binary file not shown.
12 changes: 1 addition & 11 deletions altair/utils/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pandas as pd


from ..data import limit_rows, MaxRowsError, sample, pipe, to_values,to_geojson_values
from ..data import limit_rows, MaxRowsError, sample, pipe, to_values


def _create_dataframe(N):
Expand Down Expand Up @@ -63,13 +63,3 @@ def test_type_error():
for f in (sample, limit_rows, to_values):
with pytest.raises(TypeError):
pipe(0, f)


def test_to_geojson_values():
gpd = pytest.importorskip('geopandas')
geo_data = gpd.GeoDataFrame({ "name": ['a','b']},
geometry=[gpd.geoseries.Point((1.0, 0.0)),
gpd.geoseries.Point((0.0, 1.0))],index=['i','j'])
result = pipe(geo_data, to_geojson_values)
assert result=={'format': {'property': 'features', 'type': 'json'},
'values': geo_data.__geo_interface__}
5 changes: 2 additions & 3 deletions altair/vegalite/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from toolz.curried import curry, pipe
from ..utils.core import sanitize_dataframe
from ..utils.data import (
MaxRowsError, limit_rows, sample, to_csv, to_json, to_values, to_geojson_values,
MaxRowsError, limit_rows, sample, to_csv, to_json, to_values,
check_data_type, DataTransformerRegistry
)

Expand All @@ -24,6 +24,5 @@ def default_data_transformer(data, max_rows=5000):
'to_csv',
'to_json',
'to_values',
'check_data_type',
'to_geojson_values'
'check_data_type'
)
2 changes: 1 addition & 1 deletion altair/vegalite/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .data import (
MaxRowsError,
pipe, curry, limit_rows,
sample, to_json, to_csv, to_values, to_geojson_values,
sample, to_json, to_csv, to_values,
default_data_transformer,
data_transformers
)
5 changes: 2 additions & 3 deletions altair/vegalite/v2/data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ..data import (MaxRowsError, curry, default_data_transformer, limit_rows,
pipe, sample, to_csv, to_json, to_values,to_geojson_values, DataTransformerRegistry)
pipe, sample, to_csv, to_json, to_values, DataTransformerRegistry)


# ==============================================================================
Expand Down Expand Up @@ -27,6 +27,5 @@
'to_csv',
'to_json',
'to_values',
'data_transformers',
'to_geojson_values'
'data_transformers'
)

0 comments on commit 2cd9fde

Please sign in to comment.