Resources
Snippets
[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/leafmap/blob/master)
Google basemaps
ROADMAP: https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}
SATELLITE: https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}
TERRAIN: https://mt1.google.com/vt/lyrs=p&x={x}&y={y}&z={z}
HYBRID: https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}
Data repositories
datasets: https://github.com/opengeos/datasets
Sample repositories
Website templates
Python package repositories
GitHub repositories
Geemap: https://github.com/giswqs/geemap
Leafmap: https://github.com/giswqs/leafmap
Mapwidget: https://github.com/giswqs/mapwidget
Geosdemo: https://github.com/giswqs/geosdemo
GEOG-510: https://github.com/giswqs/GEOG-510
ChatGPT: https://github.com/xtekky/gpt4free
Python Packages for Web Mapping
Python Packages for Handling Vector Datasets
Python Packages for Handling Raster Datasets
Useful Websites
Conda-forge
Conda-forge: https://conda-forge.org/
Staged-recipes: https://github.com/conda-forge/staged-recipes
Grayskull: https://pypi.org/project/grayskull
Sample recipes: https://github.com/conda-forge/staged-recipes/pulls?page=1&q=is%3Apr+is%3Aclosed+author%3Agiswqs
Interactive Web Apps
Streamlit: https://streamlit.io
Gradio: https://gradio.app
Hugging Face: https://huggingface.co
Streamlit Template for Geospatial: https://github.com/giswqs/streamlit-multipage-template
Timelapse web app: https://huggingface.co/spaces/giswqs/Streamlit
Markdown
Website templates
Free cloud-computing platforms
Create and publish a Python package
Choose a unique name for your package and make sure the name has not been taken by others on PyPI and conda-forge. The name should be short and descriptive. It can contain hyphens if needed.
Register for a PyPI account at https://pypi.org/account/register/
Activate your conda env and Install cookiecutter and twine using pip install -U cookiecutter twine. cookiecutter is for create a Python package template and twine is for uploading packages to PyPI.
Create a Python package using pypackage: cookiecutter gh:giswqs/pypackage
Create an empty GitHub repo with the same name as your Python package.
Run git init to initialize your Python package directory as a Git repository
Commit changes and push the Git repository to GitHub.
Run python setup.py sdist to generate a package distribution *.tar.gz
Run twine upload dist/*.tar.gz to upload the package to PyPI
Go to GitHub Settings - Workflow permissions and enable Read and write permissions for GitHub Actions.
Enable GitHub Pages for the repo to deploy from the gh-pages branch
GitHub Actions
GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository, or deploy merged pull requests to production.
Create an API token on PyPI: https://pypi.org/manage/account/token/
Create a new repository secret: https://github.com/giswqs/[REPO-NAME]/settings/secrets/actions
Set PYPI_USERS=__token__ and PYPI_PASSWORD to your API token
Install packages: pip install bump2version wheel
Make changes to your package. Commit changes. Then run bumpversion patch, or bumpversion minor, or bumpversion major
Push changes to GitHub: git push --tags and git push
Create a new release on GitHub
Pip
To search Python packages, visit https://pypi.org/
To list installed packages: pip list
To install a package: pip install PKGNAME
To update a package: pip install -U PKGNAME
To install a specific version of a package: pip install PKGNAME==x.x.x
To install packages from a file: pip install -r requirements.txt
To uninstall a package: pip uninstall PKGNAME
To install a package from GitHub: pip install git+https://github.com/USERNAME/REPONAME.git
Conda
Create a conda environment:
conda create -n geo python=3.11
conda activate geo
conda install -c conda-forge mamba
mamba install -c conda-forge geospatial
Check conda version: conda info
Update conda to the current version: conda update -n base conda
List all conda environments: conda env list
Create a new environment named ENVNAME with the latest Python version: conda create -n ENVNAME python
Create a new environment named ENVNAME with the a specific Python version: conda create -n ENVNAME python=3.11
Activate a name Conda environment: conda activate ENVNAME
Deactivate the current Conda environment: conda deactivate
List all package and version in the active environment: conda list
Install mamba: conda install -c conda-forge mamba
Delete an entire environment: conda remove -n ENVNAME --all
Install package from conda-forge: conda install PKGNAME -c conda-forge
Install package by exact version number: conda install PKGNAME=x.x.x -c conda-forge
Remove a package from an environment: conda uninstall PKGNAME -n ENVNAME
Git
Repositories:
geemap: https://github.com/giswqs/geemap
leafmap: https://github.com/giswqs/leafmap
GEOG-510: https://github.com/giswqs/GEOG-510
Git configuration
git config --global user.name "Your Name"
git config --global user.email "you@someplace.com"
git config --global --list
git clone https://github.com/USERNAME/REPONAME.git
Git initialization
git init
Git Commit
git add .
git commit -m "commit message"
git status
git push
git config credential.helper store
git pull
Git Branch
git checkout -b NAME
git status
git add .
git commit -m "message"
git push
Google Colab
Scratchpad Notebook: https://colab.research.google.com/notebooks/empty.ipynb
Open Notebooks from GitHub: simply replace github.com with githubtocolab.com. It will redirect you to a Colab notebook.
Timing Execution of Cell: hover over the cell run icon and you will get an estimate of the execution time taken
Run part of a cell: Click Runtime -> Run Selection button or using the keyboard shortcut Ctrl + Shift + Enter
Most commonly used shortcuts: Run cell (Ctrl + Enter), Run cell and add new cell below (Alt + Enter), Run cell and goto the next cell below (Shift + Enter), Comment current line (Ctrl + /)
Jupyter Notebook Keyboard Shortcuts: Click Tools -> Keyboard shortcuts or Just add Ctrl + M before whatever keyboard shortcut you were using in Jupyter. For example, add a cell above (Ctrl + M + A), Add a cell below (Ctrl + M + B), Change cell to code (Ctrl + M + Y), Change cell to markdown (Ctrl + M + M)
Jump to Class definition: press Ctrl and then clicking a class name
“Open in Colab” Badge: You can add a ‘Open in Colab’ badge to your README.md or jupyter notebooks using the following markdown code: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/notebooks/basic_features_overview.ipynb)
References: Google Colab Tips for Power Users, 10 tricks for a better Google Colab experience
Visual Studio Code
Command Palette: Ctrl+Shift+P
Zen Mode: View -> Appearance -> Toggle Zen Mode
Split view: View > Editor Layout > Split Up