|
33 | 33 | "metadata": {}, |
34 | 34 | "outputs": [], |
35 | 35 | "source": [ |
36 | | - "countries = geopandas.read_file(\"zip://./data/ne_110m_admin_0_countries.zip\")\n", |
37 | | - "cities = geopandas.read_file(\"zip://./data/ne_110m_populated_places.zip\")\n", |
38 | | - "rivers = geopandas.read_file(\"zip://./data/ne_50m_rivers_lake_centerlines.zip\")" |
| 36 | + "countries = geopandas.read_file(\"data/ne_110m_admin_0_countries.zip\")\n", |
| 37 | + "cities = geopandas.read_file(\"data/ne_110m_populated_places.zip\")\n", |
| 38 | + "rivers = geopandas.read_file(\"data/ne_50m_rivers_lake_centerlines.zip\")" |
39 | 39 | ] |
40 | 40 | }, |
41 | 41 | { |
|
555 | 555 | "metadata": {}, |
556 | 556 | "outputs": [], |
557 | 557 | "source": [ |
558 | | - "# Make a plot of the close-by restaurants\n", |
559 | | - "ax = stations_eiffel.to_crs(epsg=3857).plot()\n", |
560 | | - "geopandas.GeoSeries([eiffel_tower], crs='EPSG:2154').to_crs(epsg=3857).plot(ax=ax, color='red')\n", |
| 558 | + "# Make a plot of the close-by bike stations\n", |
| 559 | + "import matplotlib.pyplot as plt\n", |
561 | 560 | "import contextily\n", |
| 561 | + "\n", |
| 562 | + "fig, ax = plt.subplots(figsize=(8, 8))\n", |
| 563 | + "stations_eiffel.to_crs(epsg=3857).plot(ax=ax)\n", |
| 564 | + "geopandas.GeoSeries([eiffel_tower], crs='EPSG:2154').to_crs(epsg=3857).plot(ax=ax, color='red')\n", |
562 | 565 | "contextily.add_basemap(ax)\n", |
563 | 566 | "ax.set_axis_off()" |
564 | 567 | ] |
|
733 | 736 | "## Spatial join operation\n", |
734 | 737 | "\n", |
735 | 738 | "<div class=\"alert alert-info\" style=\"font-size:120%\">\n", |
736 | | - " \n", |
| 739 | + "\n", |
737 | 740 | "**SPATIAL JOIN** = *transferring attributes from one layer to another based on their spatial relationship* <br>\n", |
738 | 741 | "\n", |
739 | 742 | "\n", |
|
781 | 784 | "joined" |
782 | 785 | ] |
783 | 786 | }, |
| 787 | + { |
| 788 | + "cell_type": "code", |
| 789 | + "execution_count": null, |
| 790 | + "metadata": {}, |
| 791 | + "outputs": [], |
| 792 | + "source": [ |
| 793 | + "joined[joined[\"name_right\"] == \"France\"]" |
| 794 | + ] |
| 795 | + }, |
784 | 796 | { |
785 | 797 | "cell_type": "code", |
786 | 798 | "execution_count": null, |
|
1055 | 1067 | "name": "python", |
1056 | 1068 | "nbconvert_exporter": "python", |
1057 | 1069 | "pygments_lexer": "ipython3", |
1058 | | - "version": "3.8.5" |
| 1070 | + "version": "3.8.10" |
| 1071 | + }, |
| 1072 | + "widgets": { |
| 1073 | + "application/vnd.jupyter.widget-state+json": { |
| 1074 | + "state": {}, |
| 1075 | + "version_major": 2, |
| 1076 | + "version_minor": 0 |
| 1077 | + } |
1059 | 1078 | } |
1060 | 1079 | }, |
1061 | 1080 | "nbformat": 4, |
|
0 commit comments