Skip to content

Commit

Permalink
landsat stretch
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Lins committed Jan 20, 2012
1 parent 4c6e41c commit 23f7497
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/application/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/bounds', 'bounds')
CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/landsat', 'landsat')
CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/rgb/<r>/<g>/<b>/sensor/<sensor>', 'rgb_mapid')
#CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/rgb/<r>/<g>/<b>/sensor', 'sensor')

NDFIMapApi.add_urls(app, '/api/v0/report/<report_id>/map')
PolygonAPI.add_urls(app, '/api/v0/report/<report_id>/cell/<cell_pos>/polygon')
Expand Down Expand Up @@ -179,6 +180,6 @@ def testing():
s = Stats()
return jsonify(s._execute_cmd("/value", {
"image": json.dumps({"creator":"SAD/com.google.earthengine.examples.sad.GetStatsList","args":[
[{"creator":"sad_test/com.google.earthengine.examples.sad.ProdesImage","args":["PRODES_2009"]},
{"creator":"sad_test/com.google.earthengine.examples.sad.ProdesImage","args":["PRODES_IMAZON_2011a"]}],{"type":"FeatureCollection","table_id":1505198},"name"]}), "fields": "classHistogram"}))
[{"creator":"SAD/com.google.earthengine.examples.sad.ProdesImage","args":["PRODES_2009"]},
{"creator":"SAD/com.google.earthengine.examples.sad.ProdesImage","args":["PRODES_IMAZON_2011a"]}],{"type":"FeatureCollection","table_id":1505198},"name"]}), "fields": "classHistogram"}))

13 changes: 8 additions & 5 deletions src/application/ee.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_stats_for_polygon(self, assetids, polygon):

data = self._execute_cmd("/value", {
"image": json.dumps({
"creator":"sad_thau_test/com.google.earthengine.examples.sad.GetStatsList",
"creator": CALL_SCOPE + "/com.google.earthengine.examples.sad.GetStatsList",
"args":[reports, {
'features': [{
'type': 'feature',
Expand Down Expand Up @@ -178,6 +178,7 @@ def mapid(self, start, end):
'bands': ','.join(MAP_IMAGE_BANDS), #'30,20,10',
'gain': PREVIEW_GAIN
}

return self._execute_cmd("/mapid", cmd)

def _execute_cmd(self, url, cmd):
Expand Down Expand Up @@ -288,7 +289,10 @@ def rgb_strech(self, polygon, sensor, bands):
# before call /mapid in order to google earthn engine makes his work
cmd = self._RGB_streched_command(self.work_period, polygon, sensor, bands)
del cmd['bands']
cmd['fields'] = 'stats_sur_refl_b01,stats_sur_refl_b02,stats_sur_refl_b03,stats_sur_refl_b04,stats_sur_refl_b05'
if (sensor=="modis"):
cmd['fields'] = 'stats_sur_refl_b01,stats_sur_refl_b02,stats_sur_refl_b03,stats_sur_refl_b04,stats_sur_refl_b05'
else:
cmd['fields'] = 'stats_30,stats_20,stats_10'

self._execute_cmd('/value', cmd)
cmd = self._RGB_streched_command(self.work_period, polygon, sensor, bands)
Expand Down Expand Up @@ -390,7 +394,7 @@ def _change_detection_data(self, reference_period, work_period, polygons=[], col
ndfi_image_1 = self._NDFI_image(reference_period)
ndfi_image_2 = self._NDFI_image(work_period)
return {
"creator": 'sad_test/com.google.earthengine.examples.sad.ChangeDetectionData',
"creator": CALL_SCOPE + '/com.google.earthengine.examples.sad.ChangeDetectionData',
"args": [ndfi_image_1,
ndfi_image_2,
self.PRODES_IMAGE,
Expand Down Expand Up @@ -504,8 +508,7 @@ def _RGB_streched_command(self, period, polygon, sensor, bands):
{"id":"20","data_type":"float"},
{"id":"10","data_type":"float"}],
"start_time":1313020801000,
"end_time":1313279999000},
polygon]
"end_time":1313279999000}]
},polygon]
},
["30","20","10"],
Expand Down
7 changes: 7 additions & 0 deletions src/static/js/rgb_layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ var RGB_layers = [
b: 4,
sensor: 'modis',
description: 'F color infrared RGB214'
},
{
r: 30,
g: 20,
b: 10,
sensor: 'landsat',
description: 'Landsat Stretch'
}
];

Expand Down

0 comments on commit 23f7497

Please # to comment.