This tutorial in very interesting for me as I could try using Python to plot a map. Anyway, I would like to figure out the following: For the last routine about plot a country map, I have tried to plot a country map for the United States as the following coding: fig, ax_us = plt.subplots(figsize=(8,6)) countries = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres")) countries[countries["name"] == "United States"].plot(cmap='Greens_r', ax=ax_us) plt.show() However, there is the same error shown as follows: /usr/local/lib/python3.7/dist-packages/geopandas/plotting.py:681: UserWarning: The GeoDataFrame you are attempting to plot is empty. Nothing has been displayed. UserWarning, I would like to wonder what reason for plotting a country map for the US unavailable. thanks.
@@REDBRIChk Thanks for your reply w/ problem solved. On the other hand, apart from plotting a country map, I try to plot a specified city map as the following coding: fig, ax_hk = plt.subplots(figsize=(8,6)) cities = gpd.read_file(gpd.datasets.get_path("naturalearth_cities")) cities[cities["name"] == "Hong Kong, China"].plot(cmap='Blues_r', ax=ax_hk) plt.show() However, another warning message shown about “NameError: name 'gps' is not defined”. I would like to wonder if there is another code to plot the specified city, thanks.
@@jessiekinvisiblesoci You may refer to the codes provided in the following page to gpd.read_file("a shapefile") colab.research.google.com/github/la-counts/data-adventures/blob/master/Instructable_7_How_to_Analyze_Geographic_Data_in_Shapefiles.ipynb
I love your teaching.
How do I create a city map or state map instead of country map on google colab
thank you for your support. here shows an example of mapping NYC by geopandas: geopandas.org/en/stable/gallery/plotting_basemap_background.html
@@REDBRIChk thanks for this but I am unable to replicate it to Ekiti State map showing 16 local government / Nigeria.
Please can you help me out
This tutorial in very interesting for me as I could try using Python to plot a map. Anyway, I would like to figure out the following:
For the last routine about plot a country map, I have tried to plot a country map for the United States as the following coding:
fig, ax_us = plt.subplots(figsize=(8,6))
countries = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
countries[countries["name"] == "United States"].plot(cmap='Greens_r', ax=ax_us)
plt.show()
However, there is the same error shown as follows:
/usr/local/lib/python3.7/dist-packages/geopandas/plotting.py:681: UserWarning: The GeoDataFrame you are attempting to plot is empty. Nothing has been displayed.
UserWarning,
I would like to wonder what reason for plotting a country map for the US unavailable.
thanks.
If you check the names of the countries in the database, it is United States of America
@@REDBRIChk Thanks for your reply w/ problem solved.
On the other hand, apart from plotting a country map, I try to plot a specified city map as the following coding:
fig, ax_hk = plt.subplots(figsize=(8,6))
cities = gpd.read_file(gpd.datasets.get_path("naturalearth_cities"))
cities[cities["name"] == "Hong Kong, China"].plot(cmap='Blues_r', ax=ax_hk)
plt.show()
However, another warning message shown about “NameError: name 'gps' is not defined”. I would like to wonder if there is another code to plot the specified city, thanks.
@@jessiekinvisiblesoci You may refer to the codes provided in the following page to gpd.read_file("a shapefile") colab.research.google.com/github/la-counts/data-adventures/blob/master/Instructable_7_How_to_Analyze_Geographic_Data_in_Shapefiles.ipynb