FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

geopandas - for spatial join · HpcDataLab/docker-python@abf2e82 · GitHub

Commit abf2e82

Browse files
committed
geopandas - for spatial join
1 parent d2a38d5 commit abf2e82

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎Dockerfile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,3 +554,8 @@ ADD patches/tensorboard/notebook.py /opt/conda/lib/python3.6/site-packages/tenso
554554

555555
# Set backend for matplotlib
556556
ENV MPLBACKEND "agg"
557+
558+
# geospatial learn course
559+
RUN pip install rtree && \
560+
pip install osmnx && \
561+
apt-get -y install libspatialindex-dev

‎tests/test_geopandas.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@ class TestGeopandas(unittest.TestCase):
66
def test_read(self):
77
df = geopandas.read_file(geopandas.datasets.get_path('nybb'))
88
self.assertTrue(df.size > 1)
9+
10+
def test_spatial_join(self):
11+
cities = geopandas.read_file(geopandas.datasets.get_path('naturalearth_cities'))
12+
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
13+
countries = world[['geometry', 'name']]
14+
countries = countries.rename(columns={'name':'country'})
15+
cities_with_country = geopandas.sjoin(cities, countries, how="inner", op='intersects')
16+
self.assertTrue(cities_with_country.size > 1)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL