Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Removed the cell output files
Browse files Browse the repository at this point in the history
  • Loading branch information
tylere committed Sep 19, 2022
1 parent 4f5bc1c commit 5ccaeed
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 42 deletions.
89 changes: 47 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,91 @@ earthengine-jupyter

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

``` python
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
```

**NOTICE: This is an experimental project and is not an officially
supported Google project. You are welcome to use it, but we do not
guarantee stability.**

## How to use

This lib contains a `map` class that can be used to display an
This lib contains a `Map` class that can be used to display an
interactive map.

``` python
import ee
from ee_jupyter.ipyleaflet import Map
from ee_jupyter.ipyleaflet import Inspector
from ipywidgets import HBox
```

``` python
# Intialize the Earth Engine client library.
ee.Initialize()
```

``` python
img = ee.Image("LANDSAT/LC09/C02/T1_L2/LC09_044034_20220127")
map1 = Map(center=(37.5924, -122.09), zoom=8)
map1
```

Map(center=[37.5924, -122.09], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zo…

Define an Earth Engine image layer, and add it to the interactive map.

``` python
img1 = ee.Image("LANDSAT/LC09/C02/T1_L2/LC09_044034_20220127")
visualization = {
'bands': ['SR_B4', 'SR_B3', 'SR_B2'],
'min': 0.2 / 0.0000275 ,
'min': 0.2 / 0.0000275,
'max': 0.4 / 0.0000275,
};
}
map1.addLayer(eeObject=img1, visParams=visualization, name='Landsat scene')
```

We can also create an inspector object and associate it with the
previously created map.

``` python
map1 = Map(center=(37.5924, -122.09), zoom=8)
inspector1 = Inspector(map_object=map1)
from ee_jupyter.ipyleaflet import Inspector

display(HBox([map1, inspector1]))
inspector1 = Inspector(map_object=map1)
inspector1
```

HBox(children=(Map(center=[37.5924, -122.09], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom
Inspector(layout=Layout(border_bottom='solid', border_left='solid', border_right='solid', border_top='solid', …

Add an Earth Engine image to the map.
Typically when you create a inspector object, you will want to display
it near the map.

``` python
map1.addLayer(img, visualization, 'Sample image');
from ipywidgets import HBox

display(HBox([map1, inspector1]))
```

# Test earthengine-api
HBox(children=(Map(center=[37.5924, -122.09], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom…

``` python
from IPython.display import Image
```
<div>

``` python
print(img.getInfo()['id'])
```
> **Tip With Caption**
>
> Note that Jupyter widgets do not interact with each other when
> published as documentation. Open up this notebook in a Jupyter
> environment to see the interaction.
LANDSAT/LC09/C02/T1_L2/LC09_044034_20220127
</div>

# Displaying a Map Image

If you want to display a static (non-interactive) image, you can do that
as well. The `embed=True` parameter will allow the image to be saved
within the notebook.

``` python
img2 = ee.Image('CGIAR/SRTM90_V4')
url = img2.getThumbUrl({'min':0, 'max':3000, 'dimensions':'400'})
print(url)
from IPython.display import Image


visualization['dimensions'] = 400 # maximum dimension for the image
url = img1.getThumbUrl(visualization)

Image(url=url, format='png', embed=True)
```

https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails/ac806a13e67cc8e1151e9189b409c500-fea91baa41ef3314a13b4d5d411c5305:getPixels

![](index_files/figure-gfm/cell-9-output-2.png)
![](index_files/figure-gfm/cell-8-output-1.png)
Binary file removed index_files/figure-gfm/cell-8-output-2.png
Binary file not shown.
Binary file removed index_files/figure-gfm/cell-9-output-2.png
Binary file not shown.

0 comments on commit 5ccaeed

Please sign in to comment.