Csv
In [1]:
Copied!
!pip install geotask
!pip install geotask
Requirement already satisfied: geotask in /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages (0.0.6) Requirement already satisfied: ipyleaflet in /home/runner/.local/lib/python3.11/site-packages (from geotask) (0.19.0) Requirement already satisfied: numpy in /home/runner/.local/lib/python3.11/site-packages (from geotask) (1.26.4)
Requirement already satisfied: pandas in /home/runner/.local/lib/python3.11/site-packages (from geotask) (2.2.2) Requirement already satisfied: pyshp in /home/runner/.local/lib/python3.11/site-packages (from geotask) (2.3.1) Requirement already satisfied: geopandas in /home/runner/.local/lib/python3.11/site-packages (from geotask) (0.14.4) Requirement already satisfied: localtileserver in /home/runner/.local/lib/python3.11/site-packages (from geotask) (0.10.2) Requirement already satisfied: leafmap in /home/runner/.local/lib/python3.11/site-packages (from geotask) (0.31.9) Requirement already satisfied: xarray in /home/runner/.local/lib/python3.11/site-packages (from geotask) (2024.3.0) Requirement already satisfied: imageio in /home/runner/.local/lib/python3.11/site-packages (from geotask) (2.34.1) Requirement already satisfied: ipywidgets in /home/runner/.local/lib/python3.11/site-packages (from geotask) (8.1.2) Requirement already satisfied: requests in /home/runner/.local/lib/python3.11/site-packages (from geotask) (2.31.0) Requirement already satisfied: folium in /home/runner/.local/lib/python3.11/site-packages (from geotask) (0.16.0) Requirement already satisfied: matplotlib in /home/runner/.local/lib/python3.11/site-packages (from geotask) (3.8.4) Requirement already satisfied: IPython in /home/runner/.local/lib/python3.11/site-packages (from geotask) (8.24.0) Requirement already satisfied: branca>=0.6.0 in /home/runner/.local/lib/python3.11/site-packages (from folium->geotask) (0.7.2) Requirement already satisfied: jinja2>=2.9 in /home/runner/.local/lib/python3.11/site-packages (from folium->geotask) (3.1.4) Requirement already satisfied: xyzservices in /home/runner/.local/lib/python3.11/site-packages (from folium->geotask) (2024.4.0) Requirement already satisfied: fiona>=1.8.21 in /home/runner/.local/lib/python3.11/site-packages (from geopandas->geotask) (1.9.6) Requirement already satisfied: packaging in /home/runner/.local/lib/python3.11/site-packages (from geopandas->geotask) (24.0) Requirement already satisfied: pyproj>=3.3.0 in /home/runner/.local/lib/python3.11/site-packages (from geopandas->geotask) (3.6.1) Requirement already satisfied: shapely>=1.8.0 in /home/runner/.local/lib/python3.11/site-packages (from geopandas->geotask) (2.0.4)
Requirement already satisfied: python-dateutil>=2.8.2 in /home/runner/.local/lib/python3.11/site-packages (from pandas->geotask) (2.9.0.post0) Requirement already satisfied: pytz>=2020.1 in /home/runner/.local/lib/python3.11/site-packages (from pandas->geotask) (2024.1) Requirement already satisfied: tzdata>=2022.7 in /home/runner/.local/lib/python3.11/site-packages (from pandas->geotask) (2024.1)
Requirement already satisfied: pillow>=8.3.2 in /home/runner/.local/lib/python3.11/site-packages (from imageio->geotask) (10.3.0) Requirement already satisfied: jupyter-leaflet<0.20,>=0.19 in /home/runner/.local/lib/python3.11/site-packages (from ipyleaflet->geotask) (0.19.0) Requirement already satisfied: traittypes<3,>=0.2.1 in /home/runner/.local/lib/python3.11/site-packages (from ipyleaflet->geotask) (0.2.1) Requirement already satisfied: comm>=0.1.3 in /home/runner/.local/lib/python3.11/site-packages (from ipywidgets->geotask) (0.2.2) Requirement already satisfied: traitlets>=4.3.1 in /home/runner/.local/lib/python3.11/site-packages (from ipywidgets->geotask) (5.14.3) Requirement already satisfied: widgetsnbextension~=4.0.10 in /home/runner/.local/lib/python3.11/site-packages (from ipywidgets->geotask) (4.0.10) Requirement already satisfied: jupyterlab-widgets~=3.0.10 in /home/runner/.local/lib/python3.11/site-packages (from ipywidgets->geotask) (3.0.10)
Requirement already satisfied: decorator in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (5.1.1) Requirement already satisfied: jedi>=0.16 in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (0.19.1) Requirement already satisfied: matplotlib-inline in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (0.1.7) Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (3.0.43) Requirement already satisfied: pygments>=2.4.0 in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (2.18.0) Requirement already satisfied: stack-data in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (0.6.3) Requirement already satisfied: typing-extensions>=4.6 in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (4.11.0) Requirement already satisfied: pexpect>4.3 in /home/runner/.local/lib/python3.11/site-packages (from IPython->geotask) (4.9.0)
Requirement already satisfied: bqplot in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (0.12.43) Requirement already satisfied: colour in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (0.1.5) Requirement already satisfied: duckdb in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (0.10.2) Requirement already satisfied: gdown in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (5.1.0) Requirement already satisfied: geojson in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (3.1.0) Requirement already satisfied: ipyevents in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (2.0.2) Requirement already satisfied: ipyfilechooser in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (0.6.0) Requirement already satisfied: plotly in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (5.22.0) Requirement already satisfied: pystac-client in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (0.7.7) Requirement already satisfied: python-box in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (7.1.1) Requirement already satisfied: scooby in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (0.10.0)
Requirement already satisfied: whiteboxgui in /home/runner/.local/lib/python3.11/site-packages (from leafmap->geotask) (2.3.0) Requirement already satisfied: click in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (8.1.7) Requirement already satisfied: flask<4,>=2.0.0 in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (3.0.3) Requirement already satisfied: Flask-Caching in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (2.3.0) Requirement already satisfied: flask-cors in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (4.0.1) Requirement already satisfied: flask-restx>=0.5.0 in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (1.3.0) Requirement already satisfied: rio-tiler in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (6.5.0) Requirement already satisfied: rio-cogeo in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (5.3.0) Requirement already satisfied: server-thread in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (0.2.0) Requirement already satisfied: werkzeug in /home/runner/.local/lib/python3.11/site-packages (from localtileserver->geotask) (3.0.3) Requirement already satisfied: contourpy>=1.0.1 in /home/runner/.local/lib/python3.11/site-packages (from matplotlib->geotask) (1.2.1) Requirement already satisfied: cycler>=0.10 in /home/runner/.local/lib/python3.11/site-packages (from matplotlib->geotask) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in /home/runner/.local/lib/python3.11/site-packages (from matplotlib->geotask) (4.51.0) Requirement already satisfied: kiwisolver>=1.3.1 in /home/runner/.local/lib/python3.11/site-packages (from matplotlib->geotask) (1.4.5) Requirement already satisfied: pyparsing>=2.3.1 in /home/runner/.local/lib/python3.11/site-packages (from matplotlib->geotask) (3.1.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/runner/.local/lib/python3.11/site-packages (from requests->geotask) (3.3.2) Requirement already satisfied: idna<4,>=2.5 in /home/runner/.local/lib/python3.11/site-packages (from requests->geotask) (3.7) Requirement already satisfied: urllib3<3,>=1.21.1 in /home/runner/.local/lib/python3.11/site-packages (from requests->geotask) (2.2.1) Requirement already satisfied: certifi>=2017.4.17 in /home/runner/.local/lib/python3.11/site-packages (from requests->geotask) (2024.2.2)
Requirement already satisfied: attrs>=19.2.0 in /home/runner/.local/lib/python3.11/site-packages (from fiona>=1.8.21->geopandas->geotask) (23.2.0) Requirement already satisfied: click-plugins>=1.0 in /home/runner/.local/lib/python3.11/site-packages (from fiona>=1.8.21->geopandas->geotask) (1.1.1) Requirement already satisfied: cligj>=0.5 in /home/runner/.local/lib/python3.11/site-packages (from fiona>=1.8.21->geopandas->geotask) (0.7.2) Requirement already satisfied: six in /home/runner/.local/lib/python3.11/site-packages (from fiona>=1.8.21->geopandas->geotask) (1.16.0) Requirement already satisfied: itsdangerous>=2.1.2 in /home/runner/.local/lib/python3.11/site-packages (from flask<4,>=2.0.0->localtileserver->geotask) (2.2.0) Requirement already satisfied: blinker>=1.6.2 in /home/runner/.local/lib/python3.11/site-packages (from flask<4,>=2.0.0->localtileserver->geotask) (1.8.2)
Requirement already satisfied: aniso8601>=0.82 in /home/runner/.local/lib/python3.11/site-packages (from flask-restx>=0.5.0->localtileserver->geotask) (9.0.1) Requirement already satisfied: jsonschema in /home/runner/.local/lib/python3.11/site-packages (from flask-restx>=0.5.0->localtileserver->geotask) (4.22.0) Requirement already satisfied: importlib-resources in /home/runner/.local/lib/python3.11/site-packages (from flask-restx>=0.5.0->localtileserver->geotask) (6.4.0)
Requirement already satisfied: parso<0.9.0,>=0.8.3 in /home/runner/.local/lib/python3.11/site-packages (from jedi>=0.16->IPython->geotask) (0.8.4) Requirement already satisfied: MarkupSafe>=2.0 in /home/runner/.local/lib/python3.11/site-packages (from jinja2>=2.9->folium->geotask) (2.1.5) Requirement already satisfied: ptyprocess>=0.5 in /home/runner/.local/lib/python3.11/site-packages (from pexpect>4.3->IPython->geotask) (0.7.0)
Requirement already satisfied: wcwidth in /home/runner/.local/lib/python3.11/site-packages (from prompt-toolkit<3.1.0,>=3.0.41->IPython->geotask) (0.2.13)
Requirement already satisfied: cachelib<0.10.0,>=0.9.0 in /home/runner/.local/lib/python3.11/site-packages (from Flask-Caching->localtileserver->geotask) (0.9.0) Requirement already satisfied: beautifulsoup4 in /home/runner/.local/lib/python3.11/site-packages (from gdown->leafmap->geotask) (4.12.3) Requirement already satisfied: filelock in /home/runner/.local/lib/python3.11/site-packages (from gdown->leafmap->geotask) (3.14.0) Requirement already satisfied: tqdm in /home/runner/.local/lib/python3.11/site-packages (from gdown->leafmap->geotask) (4.66.4)
Requirement already satisfied: tenacity>=6.2.0 in /home/runner/.local/lib/python3.11/site-packages (from plotly->leafmap->geotask) (8.2.3) Requirement already satisfied: pystac>=1.10.0 in /home/runner/.local/lib/python3.11/site-packages (from pystac[validation]>=1.10.0->pystac-client->leafmap->geotask) (1.10.1)
Requirement already satisfied: rasterio>=1.3.3 in /home/runner/.local/lib/python3.11/site-packages (from rio-cogeo->localtileserver->geotask) (1.3.10) Requirement already satisfied: morecantile<6.0,>=5.0 in /home/runner/.local/lib/python3.11/site-packages (from rio-cogeo->localtileserver->geotask) (5.3.0) Requirement already satisfied: pydantic~=2.0 in /home/runner/.local/lib/python3.11/site-packages (from rio-cogeo->localtileserver->geotask) (2.7.1) Requirement already satisfied: cachetools in /home/runner/.local/lib/python3.11/site-packages (from rio-tiler->localtileserver->geotask) (5.3.3) Requirement already satisfied: color-operations in /home/runner/.local/lib/python3.11/site-packages (from rio-tiler->localtileserver->geotask) (0.1.3) Requirement already satisfied: httpx in /home/runner/.local/lib/python3.11/site-packages (from rio-tiler->localtileserver->geotask) (0.27.0) Requirement already satisfied: numexpr in /home/runner/.local/lib/python3.11/site-packages (from rio-tiler->localtileserver->geotask) (2.10.0)
Requirement already satisfied: uvicorn in /home/runner/.local/lib/python3.11/site-packages (from server-thread->localtileserver->geotask) (0.29.0) Requirement already satisfied: executing>=1.2.0 in /home/runner/.local/lib/python3.11/site-packages (from stack-data->IPython->geotask) (2.0.1) Requirement already satisfied: asttokens>=2.1.0 in /home/runner/.local/lib/python3.11/site-packages (from stack-data->IPython->geotask) (2.4.1) Requirement already satisfied: pure-eval in /home/runner/.local/lib/python3.11/site-packages (from stack-data->IPython->geotask) (0.2.2) Requirement already satisfied: ipytree in /home/runner/.local/lib/python3.11/site-packages (from whiteboxgui->leafmap->geotask) (0.2.2) Requirement already satisfied: whitebox in /home/runner/.local/lib/python3.11/site-packages (from whiteboxgui->leafmap->geotask) (2.3.1)
Requirement already satisfied: annotated-types>=0.4.0 in /home/runner/.local/lib/python3.11/site-packages (from pydantic~=2.0->rio-cogeo->localtileserver->geotask) (0.6.0) Requirement already satisfied: pydantic-core==2.18.2 in /home/runner/.local/lib/python3.11/site-packages (from pydantic~=2.0->rio-cogeo->localtileserver->geotask) (2.18.2)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /home/runner/.local/lib/python3.11/site-packages (from jsonschema->flask-restx>=0.5.0->localtileserver->geotask) (2023.12.1) Requirement already satisfied: referencing>=0.28.4 in /home/runner/.local/lib/python3.11/site-packages (from jsonschema->flask-restx>=0.5.0->localtileserver->geotask) (0.35.1) Requirement already satisfied: rpds-py>=0.7.1 in /home/runner/.local/lib/python3.11/site-packages (from jsonschema->flask-restx>=0.5.0->localtileserver->geotask) (0.18.1)
Requirement already satisfied: affine in /home/runner/.local/lib/python3.11/site-packages (from rasterio>=1.3.3->rio-cogeo->localtileserver->geotask) (2.4.0) Requirement already satisfied: snuggs>=1.4.1 in /home/runner/.local/lib/python3.11/site-packages (from rasterio>=1.3.3->rio-cogeo->localtileserver->geotask) (1.4.7) Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages (from rasterio>=1.3.3->rio-cogeo->localtileserver->geotask) (65.5.0) Requirement already satisfied: soupsieve>1.2 in /home/runner/.local/lib/python3.11/site-packages (from beautifulsoup4->gdown->leafmap->geotask) (2.5)
Requirement already satisfied: anyio in /home/runner/.local/lib/python3.11/site-packages (from httpx->rio-tiler->localtileserver->geotask) (4.3.0) Requirement already satisfied: httpcore==1.* in /home/runner/.local/lib/python3.11/site-packages (from httpx->rio-tiler->localtileserver->geotask) (1.0.5) Requirement already satisfied: sniffio in /home/runner/.local/lib/python3.11/site-packages (from httpx->rio-tiler->localtileserver->geotask) (1.3.1)
Requirement already satisfied: h11<0.15,>=0.13 in /home/runner/.local/lib/python3.11/site-packages (from httpcore==1.*->httpx->rio-tiler->localtileserver->geotask) (0.14.0)
Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /home/runner/.local/lib/python3.11/site-packages (from requests[socks]->gdown->leafmap->geotask) (1.7.1)
In [2]:
Copied!
#pip install --upgrade geotask
#pip install --upgrade geotask
In [3]:
Copied!
import geotask
from geotask import utils
import geotask
from geotask import utils
Read a CSV as a Pandas DataFrame¶
In [4]:
Copied!
csv = "https://raw.githubusercontent.com/opengeos/data/main/world/world_cities.csv"
df = utils.csv_to_df(csv)
df
csv = "https://raw.githubusercontent.com/opengeos/data/main/world/world_cities.csv"
df = utils.csv_to_df(csv)
df
Out[4]:
id | name | country | latitude | longitude | population | |
---|---|---|---|---|---|---|
0 | 1 | Bombo | UGA | 0.58330 | 32.53330 | 75000 |
1 | 2 | Fort Portal | UGA | 0.67100 | 30.27500 | 42670 |
2 | 3 | Potenza | ITA | 40.64200 | 15.79900 | 69060 |
3 | 4 | Campobasso | ITA | 41.56300 | 14.65600 | 50762 |
4 | 5 | Aosta | ITA | 45.73700 | 7.31500 | 34062 |
... | ... | ... | ... | ... | ... | ... |
1244 | 1245 | Rio de Janeiro | BRA | -22.92502 | -43.22502 | 11748000 |
1245 | 1246 | Sao Paulo | BRA | -23.55868 | -46.62502 | 18845000 |
1246 | 1247 | Sydney | AUS | -33.92001 | 151.18518 | 4630000 |
1247 | 1248 | Singapore | SGP | 1.29303 | 103.85582 | 5183700 |
1248 | 1249 | Hong Kong | CHN | 22.30498 | 114.18501 | 7206000 |
1249 rows × 6 columns
In [5]:
Copied!
m = geotask.Map()
m
m = geotask.Map()
m
Out[5]:
Add points on Map¶
In [6]:
Copied!
m = geotask.Map(
layout={'height': '600px'}
)
m.add_points(df)
m
m = geotask.Map(
layout={'height': '600px'}
)
m.add_points(df)
m
Out[6]: