Beispiel #1
0
from kml import path_to_kml

from models import Area, Note, Report, StatsStore, FustionTablesNames
from ee_bridge import NDFI, EELandsat, Stats, get_prodes_stats

from resources.report import ReportAPI, CellAPI, NDFIMapApi, PolygonAPI, NoteAPI, UserAPI

from resources.stats import RegionStatsAPI

from application.constants import amazon_bounds

ReportAPI.add_urls(app, '/api/v0/report')
ReportAPI.add_custom_url(app, '/api/v0/report/<report_id>/close', 'close',
                         ("POST", ))

CellAPI.add_urls(app, '/api/v0/report/<report_id>/cell')
CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/children',
                       'children')
CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/ndfi_change',
                       'ndfi_change')
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')
from flask import jsonify, request
from app import app
import settings

from models import Area, Note, Report
from ee import NDFI, EELandsat

from resources.report import ReportAPI, CellAPI, NDFIMapApi, PolygonAPI, NoteAPI, UserAPI

from application.constants import amazon_bounds

ReportAPI.add_urls(app, '/api/v0/report')
ReportAPI.add_custom_url(app, '/api/v0/report/<report_id>/close', 'close', ("POST",))

CellAPI.add_urls(app,       '/api/v0/report/<report_id>/cell')
CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/children', 'children')
CellAPI.add_custom_url(app, '/api/v0/report/<report_id>/cell/<id>/ndfi_change', 'ndfi_change')
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>', 'rgb_mapid')

NDFIMapApi.add_urls(app, '/api/v0/report/<report_id>/map')
PolygonAPI.add_urls(app, '/api/v0/report/<report_id>/cell/<cell_pos>/polygon')
NoteAPI.add_urls(app, '/api/v0/report/<report_id>/cell/<cell_pos>/note')
UserAPI.add_urls(app, '/api/v0/user')



#TODO: add auth
@app.route('/api/v0/ndfi')
from report_types import ReportType, CSVReportType, KMLReportType
from kml import path_to_kml

from models import Area, Note, Report, StatsStore, FustionTablesNames
from ee import NDFI, EELandsat, Stats

from resources.report import ReportAPI, CellAPI, NDFIMapApi, PolygonAPI, NoteAPI, UserAPI

from resources.stats import RegionStatsAPI

from application.constants import amazon_bounds

ReportAPI.add_urls(app, "/api/v0/report")
ReportAPI.add_custom_url(app, "/api/v0/report/<report_id>/close", "close", ("POST",))

CellAPI.add_urls(app, "/api/v0/report/<report_id>/cell")
CellAPI.add_custom_url(app, "/api/v0/report/<report_id>/cell/<id>/children", "children")
CellAPI.add_custom_url(app, "/api/v0/report/<report_id>/cell/<id>/ndfi_change", "ndfi_change")
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>", "rgb_mapid")

NDFIMapApi.add_urls(app, "/api/v0/report/<report_id>/map")
PolygonAPI.add_urls(app, "/api/v0/report/<report_id>/cell/<cell_pos>/polygon")
NoteAPI.add_urls(app, "/api/v0/report/<report_id>/cell/<cell_pos>/note")
UserAPI.add_urls(app, "/api/v0/user")

RegionStatsAPI.add_urls(app, "/api/v0/report/<report_id>/stats")
RegionStatsAPI.add_custom_url(app, "/api/v0/stats/polygon", "polygon", methods=("POST",))

# TODO: this function needs a huge refactor