-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow-ASNARO1_test0.py
107 lines (88 loc) · 3.28 KB
/
show-ASNARO1_test0.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Reference link:
# https://www.tellusxdp.com/ja/howtouse/dev/20200219_000172.html
# How to use the ASNARO1 API from Tellus
import json, requests, time
from skimage import io
TOKEN = "YOUR TOKEN HERE"
# 任意の最小緯度・経度、最大緯度・経度を入力します
# Set your latitute and longitude
min_lat = 32.4440
min_lon = 129.5224
max_lat = 33.4440
max_lon = 130.5224
# URLはサーバーURL+parametersとなります
# Put the URL and parameters
url = "https://gisapi.tellusxdp.com/api/v1/asnaro1/scene" \
+ "?min_lat={}&min_lon={}&max_lat={}&max_lon={}".format(min_lat, min_lon, max_lat, max_lon)
# header情報として、トークンを設定します
# Put your API-token on header
headers = {
"Authorization": "Bearer " + TOKEN
}
r = requests.get(url, headers=headers)
# Check the URL and Http request status
print("URL:", r.url)
print("Status: ", r.status_code)
# Get all json data from the longitude and latitude we have defined before
print(r.json())
#シーン情報を変数に格納
#Put json information as scenes
scenes = r.json()
# Find the number of scenes
number_scenes = scenes.__len__()
print ("Number of scenes: ", number_scenes)
# Print information on each scene at specific index
imgIndex = 0
if (imgIndex <= number_scenes):
acquisitionDate = scenes[imgIndex]['acquisitionDate']
cloudCover = scenes[imgIndex]['cloudCover']
entityId = scenes[imgIndex]['entityId']
productId = scenes[imgIndex]['productId']
thumbs_url = scenes[imgIndex]['thumbs_url']
img_thumbs = io.imread(thumbs_url)
print('imageIndex \t: ', imgIndex)
print('imageDate \t: ', acquisitionDate)
print('cloudCover \t: ',cloudCover)
print('entityId \t: ',entityId)
print('productId \t: ',productId)
print('thumbs_url \t: ',thumbs_url)
# Print the image
io.imshow(img_thumbs)
#increment the imgIndex
imgIndex = imgIndex + 1
# Print information on each scene at specific index
if (imgIndex <= number_scenes):
acquisitionDate = scenes[imgIndex]['acquisitionDate']
cloudCover = scenes[imgIndex]['cloudCover']
entityId = scenes[imgIndex]['entityId']
productId = scenes[imgIndex]['productId']
thumbs_url = scenes[imgIndex]['thumbs_url']
img_thumbs = io.imread(thumbs_url)
print('imageIndex \t: ', imgIndex)
print('imageDate \t: ', acquisitionDate)
print('cloudCover \t: ',cloudCover)
print('entityId \t: ',entityId)
print('productId \t: ',productId)
print('thumbs_url \t: ',thumbs_url)
# Print the image
io.imshow(img_thumbs)
#increment the imgIndex
imgIndex = imgIndex + 1
# Print information on each scene at specific index
if (imgIndex <= number_scenes):
acquisitionDate = scenes[imgIndex]['acquisitionDate']
cloudCover = scenes[imgIndex]['cloudCover']
entityId = scenes[imgIndex]['entityId']
productId = scenes[imgIndex]['productId']
thumbs_url = scenes[imgIndex]['thumbs_url']
img_thumbs = io.imread(thumbs_url)
print('imageIndex \t: ', imgIndex)
print('imageDate \t: ', acquisitionDate)
print('cloudCover \t: ',cloudCover)
print('entityId \t: ',entityId)
print('productId \t: ',productId)
print('thumbs_url \t: ',thumbs_url)
# Print the image
io.imshow(img_thumbs)
#increment the imgIndex
imgIndex = imgIndex + 1