Git Product home page Git Product logo

h3-py-notebooks's Introduction

h3-py Notebooks

version

Welcome to H3 in Jupyter Notebooks!

H3 is a hierarchical hexagonal geospatial indexing system.

This repo is a gallery of Jupyter notebooks including H3 Python API tutorials, examples and visualizations. You can visualize them on NBViewer, mybinder, or execute jupyter notebook from your own terminal. To execute notebooks locally, you need to install h3-py.

You are more than welcome to contribute new notebooks. Before we can merge your changes, you must agree to the Uber Contributor License Agreement.

This repo is licensed under Apache 2.0 License.

h3-py-notebooks's People

Contributors

ajfriend avatar camelia-c avatar dahnj avatar tenghu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

h3-py-notebooks's Issues

Dataset in urban_analytics notebook has wrong URL

The attempt to download Toulouse bus stops does not work because there is a misplaced 0 in the URL.

Solution

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

ValueError: 'left_df' should be GeoDataFrame, got <class 'pandas.core.frame.DataFrame'>

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'>

Used images that are not requested in the urban_analytics notebook

Hello. I've been trying to run the urban_analytics.ipynb` notebook, but there are some images that are not downloaded previously and that you not show how to download, which stops me from continuing the tutorial.
image

Any word of advice about to download those images would be really helpful. Thanks in advance!

kring_smoothing is not averaging over its k-ring neighbors

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()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.