uber / h3-py-notebooks Goto Github PK
View Code? Open in Web Editor NEWJupyter notebooks for h3-py, a hierarchical hexagonal geospatial indexing system
Home Page: https://h3geo.org/
License: Apache License 2.0
Jupyter notebooks for h3-py, a hierarchical hexagonal geospatial indexing system
Home Page: https://h3geo.org/
License: Apache License 2.0
I understand that the intention of the kring_smoothing function is to assign to each cell the "k-ring moving average" of its k-ring neighbors. If this is the idea (maybe the meaning is different), I think the function is not correct, it is quite similar but not the same.
Currently when you are merging:
.merge(df[[hex_col,metric_col]]).fillna(0)
You are assigning to each of the hexk neighbors of a cell the values of the cell value, so each new hexk cell will have the average of all of the cell for which it is a k-ring neighbor. This causes that new cells that were not present appear after the smoothing (so the metric 'mass' is conservative) because even if not present in the original set, the boundary cells will create new neighbors
As far as I understand, the way to smooth would be to assign to each cell the average of all its k-ring neighbors, like a moving mean but with hexagonal rings. Little modifications has to be made in the merge and group_by. Merging against hexk instead of hex_col (but to avoid the mess of columns names suffixes the trick is to temporarily rename the hex_col to hexk in the original data frame and performing a mean in the group by).
.merge(df.loc[:,[hex_col,metric_col]].rename(columns={hex_col:'hexk'}), how='left').fillna(0)
.groupby([hex_col])[[metric_col]].mean()
The attempt to download Toulouse bus stops does not work because there is a misplaced 0 in the URL.
Change
https://data.toulouse-metropole.fr/explore/dataset/arrets-de-bus0/download/?format=geojson&timezone=Europe/Helsinki
to
https://data.toulouse-metropole.fr/explore/dataset/arrets-de-bus/download/?format=geojson&timezone=Europe/London&lang=fr
There's an error in https://nbviewer.jupyter.org/github/uber/h3-py-notebooks/blob/master/notebooks/unified_data_layers.ipynb
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-8-6f0a33b43f95> in <module>
29 plt.title('hex-grid: nyc')
30 # Intersect Hex Point with CT Polygon
---> 31 df_ct = geopandas.tools.sjoin(gdf, dfh, how="inner")
32 df_ct.sample(3)
33
~/work/h3-py/uber/h3-py-notebooks/env/lib/python3.7/site-packages/geopandas/tools/sjoin.py in sjoin(left_df, right_df, how, op, lsuffix, rsuffix)
35 if not isinstance(left_df, GeoDataFrame):
36 raise ValueError(
---> 37 "'left_df' should be GeoDataFrame, got {}".format(type(left_df))
38 )
39
ValueError: 'left_df' should be GeoDataFrame, got <class 'pandas.core.frame.DataFrame'>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.