geosolutions-it / gfdrr-det

Data Exploration Tool
https://waffle.io/geosolutions-it/gfdrr-det
GNU General Public License v3.0
3 stars 0 forks source link

single layer counts can now be updated on-the-fly #84

Closed ricardogsilva closed 6 years ago

ricardogsilva commented 6 years ago

This PR is connected to #13

Notable changes:

The following are two examples of requests and responses that show the pre-calculated values and the calculation on-the-fly (both requests are asking for layer 'uga_v10_buildings_136'):

/gfdrr_det/api/v1/exposure/327

{
  "id": 327,
  "type": "Feature",
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          29.5564174652,
          -1.4970809221
        ],
        [
          29.5564174652,
          4.2136311531
        ],
        [
          35.027256012,
          4.2136311531
        ],
        [
          35.027256012,
          -1.4970809221
        ],
        [
          29.5564174652,
          -1.4970809221
        ]
      ]
    ]
  },
  "properties": {
    "url": "http://10.0.1.95:8000/gfdrr_det/api/v1/exposures/327/?format=json",
    "title": "Uga v10 buildings 136",
    "name": "uga_v10_buildings_136",
    "description": "Uganda exposure v10 by ImageCat",
    "category": "buildings",
    "aggregation_type": "aggregated",
    "wms_url": "http://10.0.1.95:8080/geoserver/hev-e/wms",
    "counts": {
      "data": {
        "category": "buildings",
        "taxonomic_categories": {
          "counts": {
            "construction_material": {
              "unknown": 110617,
              "masonry": 526429,
              "wood": 134913,
              "concrete": 18283
            },
            "occupancy": {
              "unknown": 790242
            },
            "construction_date": {
              "unknown": 790242
            }
          }
        },
        "taxonomy_source": "GEM taxonomy",
        "area_type": "aggregated"
      },
      "name": "Number of assets"
    }
  }
}
# the following bbox parameter defines a rectangle over northwestern Uganda
/gfdrr_det/api/v1/exposure/327/?bbox=29.796695,2.354701,32.857507,3.853763

{
  "id": 327,
  "type": "Feature",
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          29.5564174652,
          -1.4970809221
        ],
        [
          29.5564174652,
          4.2136311531
        ],
        [
          35.027256012,
          4.2136311531
        ],
        [
          35.027256012,
          -1.4970809221
        ],
        [
          29.5564174652,
          -1.4970809221
        ]
      ]
    ]
  },
  "properties": {
    "url": "http://10.0.1.95:8000/gfdrr_det/api/v1/exposures/327/?format=json",
    "title": "Uga v10 buildings 136",
    "name": "uga_v10_buildings_136",
    "description": "Uganda exposure v10 by ImageCat",
    "category": "buildings",
    "aggregation_type": "aggregated",
    "wms_url": "http://10.0.1.95:8080/geoserver/hev-e/wms",
    "counts": {
      "data": {
        "construction_material": {
          "concrete": 1505,
          "masonry": 52685,
          "wood": 13336,
          "unknown": 11514
        },
        "occupancy": {
          "unknown": 79040
        },
        "construction_date": {
          "unknown": 79040
        }
      },
      "name": "Number of assets"
    }
  }
}