Skip to content

Instantly share code, notes, and snippets.

@tylere
Created November 14, 2020 19:15
Show Gist options
  • Select an option

  • Save tylere/8ef9ab3c14d15f71467cc0e887d54261 to your computer and use it in GitHub Desktop.

Select an option

Save tylere/8ef9ab3c14d15f71467cc0e887d54261 to your computer and use it in GitHub Desktop.
Example getThumbURL scale parameter.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Example getThumbURL scale parameter.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyNCoRN6CP5shUdCoPLacokf",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/tylere/8ef9ab3c14d15f71467cc0e887d54261/example-getthumburl-scale-parameter.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Ux1y3u0wKSMx"
},
"source": [
"This script demonstrate that the undocumented `scale` parameter is recognized by `ee.Image.getThumbURL`."
]
},
{
"cell_type": "code",
"metadata": {
"id": "5JJhsQg5Jf-A"
},
"source": [
"import ee\n",
"ee.Authenticate()\n",
"ee.Initialize()"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "ofV3cYA1KiBo"
},
"source": [
"# Display the method docs for ee.Image.getThumbURL.\n",
"ee.Image.getThumbURL?"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "LIDWwFUTJgjb",
"outputId": "b0a3a385-b2fa-4ca5-d941-e0e8d34eb8fd",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"url = ee.Image('USGS/SRTMGL1_003').getThumbURL(\n",
" params={'scale':1e5}\n",
")\n",
"print(url)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails/6e1b7a832fe2a0099ce335a22b880ede-e6b30b0a50054472dc38edb153730cb4:getPixels\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "Yd9r-aTfKwW4",
"outputId": "084ef037-f707-40c3-97d4-71ee2a8fc62f",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 223
}
},
"source": [
"from IPython.display import Image\n",
"Image(url=url)"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<img src=\"https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails/6e1b7a832fe2a0099ce335a22b880ede-e6b30b0a50054472dc38edb153730cb4:getPixels\"/>"
],
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"metadata": {
"tags": []
},
"execution_count": 10
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "3O_YHSB0K9Mg"
},
"source": [
""
],
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment