Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging cartoee features into geemap #157

Closed
KMarkert opened this issue Oct 21, 2020 · 13 comments
Closed

Merging cartoee features into geemap #157

KMarkert opened this issue Oct 21, 2020 · 13 comments
Assignees
Labels
enhancement improvements to geemap Feature Request New feature or request
Projects

Comments

@KMarkert
Copy link
Member

cartoee is a Python package meant to assist Earth Engine users in creating publication quality maps. This was a project started over two years ago and was developed primarily to support a small group in figure creation. This package is admittedly not so well maintained... I feel that geemap and cartoee have a similar broad goal in aiding visualization of EE data but with slightly different end target visualizations (one for creating publication figures the other for interactive mapping).

Gauging interest here on taking functionality from cartotee and merging it into geemap so that geemap becomes the one-stop shop for EE visualization using the Python API.

I imagine that we can have another module with optional dependencies where users can call from geemap import cartoee (or whatever we want to name the module) and create the figure. This module would have to be somewhat isolated given that cartoee dependencies (cython and cartopy) can make installation complex. Users should be able to install the optional dependencies to use the cartoee module if they want but it will not be needed for the majority of users.

@giswqs what are your thoughts on this?

@Blue101black
Copy link

Wow! This is incredible. Wish I had known about this 12 weeks ago. Geemap, I kind of assumed was the go to for using the Google earth Engine API with Python, didn't know about this module. Amazing.

@KMarkert
Copy link
Member Author

Hi @Blue101black 👋 I would say geemap has established itself as the community standard for working with EE using the Python API. There are a lot of features within the package that make it easier to use and visualize EE results.

Including other features that users would find useful to further reduce the barrier in using ee will make geemap even more useful. Hopefully adding something like the cartoee functionality will be useful for your work.

@giswqs
Copy link
Member

giswqs commented Oct 21, 2020

@KMarkert This would a great addition to geemap, making geemap an interactive mapping library that can generate publication-quality maps. 1+1 > 2. Please feel free to create a pull request.

@giswqs giswqs added enhancement improvements to geemap Feature Request New feature or request labels Oct 21, 2020
@KMarkert
Copy link
Member Author

Working branch has been pushed to feature/cartoee

The module has been isolated as not to interfere with base dependencies, users will have to run from geemap import cartoee to use.

On the topic of dependencies, cartopy is usually a pain to install...I tested running pip install cartopy to mimic adding the package to requirements.txt but no success there. The only way I was able to get the cartoee module dependencies working was with conda. Any guidance on how/where to add in information on install this modules dependencies?

@giswqs
Copy link
Member

giswqs commented Oct 23, 2020

Thanks a lot for your prompt action! One potential solution is to check cartopy installation when the module is imported. If users are using conda, then proceeds with the installation automatically. Otherwise, prompts users to install cartopy manually.

import os
import sys
import subprocess

def check_cartopy():    

    try:
        import cartopy
    except ImportError:
        print('The cartopy package is not installed.')
        is_conda = os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
        if is_conda:
            print('Installing cartopy ...')
            subprocess.check_call(["conda", 'install', 'cartopy', '-c', 'conda-forge'])
        else:
            raise Exception("Please install cartopy following the instructions at https://scitools.org.uk/cartopy/docs/latest/installing.html")

@giswqs
Copy link
Member

giswqs commented Oct 23, 2020

Conda is so slow in resolving dependencies. It has been spinning for 15 minutes now.

@KMarkert
Copy link
Member Author

I like that suggestion! I can add checks to make sure that all of the dependencies are installed when importing the package in the example you provided.

I have had the same issues where conda can be really slow especially with conflicts...unfortunately, I don't think we can get around using conda to install cartopy at this moment.

@giswqs
Copy link
Member

giswqs commented Oct 23, 2020

I just tested it with mamba, so much faster. It only took a few seconds to resolve dependencies

conda create -n carto python=3.8
conda activate carto
conda install mamba -c conda-forge
mamba install cartopy -c conda-forge

@KMarkert
Copy link
Member Author

KMarkert commented Oct 23, 2020

mamba seems to be the preferred approach given it is much quicker. We can create tiered approach checking for mamba first then conda if mamba is not installed. If both aren't in the path then raise exception.

@giswqs giswqs added this to To do in geemap via automation Oct 27, 2020
@giswqs giswqs moved this from To do to Done in geemap Oct 27, 2020
giswqs added a commit that referenced this issue Oct 27, 2020
@giswqs
Copy link
Member

giswqs commented Oct 27, 2020

API docs for the cartoee module has been added.

https://giswqs.github.io/geemap/cartoee

@giswqs giswqs closed this as completed Oct 27, 2020
@HappyR90
Copy link

Unable to properly install 'cartopy' that is asked while running the command, 'from geemap import cartoee'. Tried using pip, conda and mamba.

giswqs added a commit that referenced this issue Nov 12, 2020
@giswqs
Copy link
Member

giswqs commented Nov 12, 2020

@hyjk-git It is very challenging to install cartopy on Windows. You might want to try Google Colab. See this example.

@HappyR90
Copy link

@hyjk-git It is very challenging to install cartopy on Windows. You might want to try Google Colab. See this example.

Thank you Dr Wu. It is working on Google Colab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to geemap Feature Request New feature or request
Projects
geemap
  
Done
Development

No branches or pull requests

4 participants