Skip to content

Commit

Permalink
Updated notebook examples
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Mar 21, 2020
1 parent ac08559 commit 3bbc830
Show file tree
Hide file tree
Showing 25 changed files with 369 additions and 716 deletions.
30 changes: 13 additions & 17 deletions geemap/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,22 +908,22 @@ def download_from_gdrive(gfile_url, file_name, out_dir='.', unzip=True):

if __name__ == '__main__':

# # Create a temporary working directory
# work_dir = os.path.join(os.path.expanduser('~'), 'geemap')
# # Get Earth Engine JavaScript examples. There are five examples in the geemap package data folder.
# # Change js_dir to your own folder containing your Earth Engine JavaScripts, such as js_dir = '/path/to/your/js/folder'
# js_dir = get_js_examples(out_dir=work_dir)
# Create a temporary working directory
work_dir = os.path.join(os.path.expanduser('~'), 'geemap')
# Get Earth Engine JavaScript examples. There are five examples in the geemap package data folder.
# Change js_dir to your own folder containing your Earth Engine JavaScripts, such as js_dir = '/path/to/your/js/folder'
js_dir = get_js_examples(out_dir=work_dir)

# # Convert all Earth Engine JavaScripts in a folder recursively to Python scripts.
# js_to_python_dir(in_dir=js_dir, out_dir=js_dir, use_qgis=True)
# print("Python scripts saved at: {}".format(js_dir))
# Convert all Earth Engine JavaScripts in a folder recursively to Python scripts.
js_to_python_dir(in_dir=js_dir, out_dir=js_dir, use_qgis=True)
print("Python scripts saved at: {}".format(js_dir))

# # Convert all Earth Engine Python scripts in a folder recursively to Jupyter notebooks.
# nb_template = get_nb_template() # Get the notebook template from the package folder.
# py_to_ipynb_dir(js_dir, nb_template)
# Convert all Earth Engine Python scripts in a folder recursively to Jupyter notebooks.
nb_template = get_nb_template() # Get the notebook template from the package folder.
py_to_ipynb_dir(js_dir, nb_template)

# # Execute all Jupyter notebooks in a folder recursively and save the output cells.
# execute_notebook_dir(in_dir=js_dir)
# Execute all Jupyter notebooks in a folder recursively and save the output cells.
execute_notebook_dir(in_dir=js_dir)

# # # Download a file from a URL.
# # url = 'https://github.com/giswqs/whitebox/raw/master/examples/testdata.zip'
Expand All @@ -933,10 +933,6 @@ def download_from_gdrive(gfile_url, file_name, out_dir='.', unzip=True):
# # g_url = 'https://drive.google.com/file/d/18SUo_HcDGltuWYZs1s7PpOmOq_FvFn04/view?usp=sharing'
# # download_from_gdrive(g_url, 'testdata.zip')

# download_gee_app('https://gena.users.earthengine.app/view/basin-selector')
update_nb_header('/media/hdd/Dropbox/git/geemap/examples/template/templatexx.ipynb', 'google')


# # # parser = argparse.ArgumentParser()
# # # parser.add_argument('--input', type=str,
# # # help="Path to the input JavaScript file")
Expand Down
24 changes: 12 additions & 12 deletions tutorials/FeatureCollection/01_us_census_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"states = ee.FeatureCollection('TIGER/2018/States')\n",
"\n",
"Map.centerObject(states, 4)\n",
"Map.addLayer(states, {}, 'US States')\n",
"\n",
"Map.setControlVisibility(layerControl=True, fullscreenControl=True, latLngPopup=True)\n",
"Map.addLayerControl()\n",
"Map"
]
},
Expand Down Expand Up @@ -139,7 +139,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"states = ee.FeatureCollection('TIGER/2018/States')\n",
"image = ee.Image().paint(states, 0, 2)\n",
Expand Down Expand Up @@ -181,7 +181,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"tn = ee.FeatureCollection('TIGER/2018/States') \\\n",
" .filter(ee.Filter.eq(\"NAME\", 'Tennessee')) \n",
Expand Down Expand Up @@ -245,7 +245,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"selected = ee.FeatureCollection('TIGER/2018/States') \\\n",
" .filter(ee.Filter.inList(\"NAME\", ['Tennessee', 'Alabama', 'Georgia']))\n",
Expand Down Expand Up @@ -1214,7 +1214,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"states = ee.FeatureCollection('TIGER/2018/States')\n",
"\n",
Expand Down Expand Up @@ -1399,7 +1399,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"dataset = ee.FeatureCollection('TIGER/2010/Blocks') \\\n",
" .filter(ee.Filter.eq('statefp10', '47'))\n",
Expand Down Expand Up @@ -1459,7 +1459,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"Map.setCenter(-110, 40, 5)\n",
"states = ee.FeatureCollection('TIGER/2018/States') \n",
Expand All @@ -1485,7 +1485,7 @@
"Map.addLayer(state_image, visParams, 'TIGER/2016/States');\n",
"Map.addLayer(ee.Image().paint(counties, 0, 1), {}, 'TIGER/2016/Counties')\n",
"\n",
"Map.setControlVisibility(layerControl=True, fullscreenControl=True, latLngPopup=True)\n",
"Map.addLayerControl()\n",
"Map"
]
},
Expand Down Expand Up @@ -1523,7 +1523,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"dataset = ee.FeatureCollection('TIGER/2010/Tracts_DP1')\n",
"visParams = {\n",
Expand All @@ -1543,7 +1543,7 @@
"\n",
"Map.addLayer(image, visParams, 'TIGER/2010/Tracts_DP1')\n",
"\n",
"Map.setControlVisibility(layerControl=True, fullscreenControl=True, latLngPopup=True)\n",
"Map.addLayerControl()\n",
"Map"
]
},
Expand Down Expand Up @@ -1579,7 +1579,7 @@
],
"source": [
"Map = folium.Map(location=[40, -100], zoom_start=4)\n",
"Map.setOptions('HYBRID')\n",
"\n",
"\n",
"fc = ee.FeatureCollection('TIGER/2016/Roads')\n",
"Map.setCenter(-73.9596, 40.7688, 12)\n",
Expand Down
131 changes: 42 additions & 89 deletions tutorials/Image/01_image_overview.ipynb

Large diffs are not rendered by default.

0 comments on commit 3bbc830

Please sign in to comment.