Skip to content

Commit

Permalink
implementing /density/groupBy/boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
kowatsch committed Aug 16, 2018
1 parent bf3a4cb commit 541ebe0
Show file tree
Hide file tree
Showing 8 changed files with 403 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/** Holds the default values for the parameters to run test-requests in Swagger. */
public class DefaultSwaggerParameters {

public static final String BBOX = "8.6128,49.3183,8.7294,49.4376";
public static final String BBOX = "85.2,27.6,85.45,27.8";
public static final String TYPE = "way";
public static final String HIGHWAY_KEY = "highway";
public static final String BUILDING_KEY = "building";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,50 @@ public Response getAreaDensityGroupByType(
userids, time, showMetadata));
}

/**
* GET request giving the density of selected items (area of items per square-kilometers) grouped
* by the boundary parameter (bounding box/circle/polygon).
* <p>
* The parameters are described in the
* {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.dataAggregation.CountController#getCount(String, String, String, String[], String[], String[], String[], String[], String)
* getCount} method.
*
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.Response
* Response}
*/
@ApiOperation(
value = "Density of selected items (area of items per square-kilometers) grouped by the boundary (bboxes, bcircles, or bpolys)",
nickname = "getElementsAreaGroupByBoundary")
@RequestMapping(value = "/density/groupBy/boundary", method = RequestMethod.GET,
produces = "application/json")
public Response getAreaDensityGroupByBoundary(
@ApiParam(hidden = true) @RequestParam(value = "bboxes", defaultValue = "",
required = false) String bboxes,
@ApiParam(hidden = true) @RequestParam(value = "bcircles", defaultValue = "",
required = false) String bcircles,
@ApiParam(hidden = true) @RequestParam(value = "bpolys", defaultValue = "",
required = false) String bpolys,
@ApiParam(hidden = true) @RequestParam(value = "types", defaultValue = "",
required = false) String[] types,
@ApiParam(hidden = true) @RequestParam(value = "keys", defaultValue = "",
required = false) String[] keys,
@ApiParam(hidden = true) @RequestParam(value = "values", defaultValue = "",
required = false) String[] values,
@ApiParam(hidden = true) @RequestParam(value = "userids", defaultValue = "",
required = false) String[] userids,
@ApiParam(hidden = true) @RequestParam(value = "time", defaultValue = "",
required = false) String[] time,
@ApiParam(hidden = true) @RequestParam(value = "format", defaultValue = "",
required = false) String format,
@ApiParam(hidden = true) @RequestParam(value = "showMetadata",
defaultValue = "false") String showMetadata)
throws UnsupportedOperationException, Exception {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.AREA, RequestParameters.of(false, true, true, bboxes, bcircles, bpolys,
types, keys, values, userids, time, format, showMetadata));
}

/**
* GET request giving the density of selected items (area of items per square-kilometers) grouped
* by the tag.
Expand Down Expand Up @@ -1192,6 +1236,60 @@ public Response postAreaDensityGroupByType(String bboxes, String bcircles, Strin
userids, time, showMetadata));
}

/**
* POST request giving the density of OSM elements (area of items per square-kilometers) grouped
* by the boundary parameter (bounding box/circle/polygon). POST requests should only be used if
* the request URL would be too long for a GET request.
* <p>
* The parameters are described in the
* {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.dataAggregation.CountController#getCount(String, String, String, String[], String[], String[], String[], String[], String)
* getCount} method.
*
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.Response
* Response}
*/
@ApiOperation(
value = "Density of OSM elements (area of items per square-kilometers) grouped by the boundary (bboxes, bcircles, or bpolys)",
nickname = "postElementsAreaGroupByBoundary")
@ApiImplicitParams({
@ApiImplicitParam(name = "bboxes", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.BBOX, required = false,
value = ParameterDescriptions.BBOXES_DESCR),
@ApiImplicitParam(name = "bcircles", paramType = "form", dataType = "string",
required = false, value = ParameterDescriptions.BCIRCLES_DESCR),
@ApiImplicitParam(name = "bpolys", paramType = "form", dataType = "string", required = false,
value = ParameterDescriptions.BPOLYS_DESCR),
@ApiImplicitParam(name = "types", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.TYPE, required = false,
value = ParameterDescriptions.TYPES_DESCR),
@ApiImplicitParam(name = "keys", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.BUILDING_KEY, required = false,
value = ParameterDescriptions.KEYS_DESCR),
@ApiImplicitParam(name = "values", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.RESIDENTIAL_VALUE, required = false,
value = ParameterDescriptions.VALUES_DESCR),
@ApiImplicitParam(name = "userids", paramType = "form", dataType = "string", required = false,
value = ParameterDescriptions.USERIDS_DESCR),
@ApiImplicitParam(name = "time", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.TIME, required = false,
value = ParameterDescriptions.TIME_DESCR),
@ApiImplicitParam(name = "format", paramType = "form", dataType = "string", required = false,
value = ParameterDescriptions.FORMAT_DESCR),
@ApiImplicitParam(name = "showMetadata", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.SHOW_METADATA, required = false,
value = ParameterDescriptions.SHOW_METADATA_DESCR)})
@RequestMapping(value = "/density/groupBy/boundary", method = RequestMethod.POST,
produces = "application/json", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public Response postAreaDensityGroupByBoundary(String bboxes, String bcircles, String bpolys,
String[] types, String[] keys, String[] values, String[] userids, String[] time,
String format, String showMetadata)
throws UnsupportedOperationException, Exception, BadRequestException {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.AREA, RequestParameters.of(true, true, true, bboxes, bcircles, bpolys,
types, keys, values, userids, time, format, showMetadata));
}

/**
* POST request giving the density of selected items (area of items per square-kilometers) grouped
* by the tag. POST requests should only be used if the request URL would be too long for a GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,50 @@ public Response getCountDensityGroupByType(
userids, time, showMetadata));
}

/**
* GET request giving the density of OSM objects grouped by the boundary parameter (bounding
* box/circle/polygon).
* <p>
* The parameters are described in the
* {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.dataAggregation.CountController#getCount(String, String, String, String[], String[], String[], String[], String[], String)
* getCount} method.
*
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.Response
* Response}
*/
@ApiOperation(
value = "Density of OSM elements grouped by the boundary (bboxes, bcircles, or bpolys)",
nickname = "getElementsCountDensityGroupByBoundary")
@RequestMapping(value = "/density/groupBy/boundary", method = RequestMethod.GET,
produces = "application/json")
public Response getCountDensityGroupByBoundary(
@ApiParam(hidden = true) @RequestParam(value = "bboxes", defaultValue = "",
required = false) String bboxes,
@ApiParam(hidden = true) @RequestParam(value = "bcircles", defaultValue = "",
required = false) String bcircles,
@ApiParam(hidden = true) @RequestParam(value = "bpolys", defaultValue = "",
required = false) String bpolys,
@ApiParam(hidden = true) @RequestParam(value = "types", defaultValue = "",
required = false) String[] types,
@ApiParam(hidden = true) @RequestParam(value = "keys", defaultValue = "",
required = false) String[] keys,
@ApiParam(hidden = true) @RequestParam(value = "values", defaultValue = "",
required = false) String[] values,
@ApiParam(hidden = true) @RequestParam(value = "userids", defaultValue = "",
required = false) String[] userids,
@ApiParam(hidden = true) @RequestParam(value = "time", defaultValue = "",
required = false) String[] time,
@ApiParam(hidden = true) @RequestParam(value = "format", defaultValue = "",
required = false) String format,
@ApiParam(hidden = true) @RequestParam(value = "showMetadata",
defaultValue = "false") String showMetadata)
throws UnsupportedOperationException, Exception {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.COUNT, RequestParameters.of(false, true, true, bboxes, bcircles, bpolys,
types, keys, values, userids, time, format, showMetadata));
}

/**
* GET request giving the density of selected items (number of items per square-kilometers)
* grouped by the tag.
Expand Down Expand Up @@ -1212,6 +1256,60 @@ public Response postCountDensityGroupByType(String bboxes, String bcircles, Stri
userids, time, showMetadata));
}

/**
* POST request giving the density of OSM objects grouped by the boundary parameter (bounding
* box/circle/polygon). POST requests should only be used if the request URL would be too long for
* a GET request.
* <p>
* The parameters are described in the
* {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.dataAggregation.CountController#getCount(String, String, String, String[], String[], String[], String[], String[], String)
* getCount} method.
*
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.Response
* Response}
*/
@ApiOperation(
value = "Density of OSM elements grouped by the boundary (bboxes, bcircles, or bpolys)",
nickname = "postElementsCountDensityGroupByBoundary")
@ApiImplicitParams({
@ApiImplicitParam(name = "bboxes", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.BBOX, required = false,
value = ParameterDescriptions.BBOXES_DESCR),
@ApiImplicitParam(name = "bcircles", paramType = "form", dataType = "string",
required = false, value = ParameterDescriptions.BCIRCLES_DESCR),
@ApiImplicitParam(name = "bpolys", paramType = "form", dataType = "string", required = false,
value = ParameterDescriptions.BPOLYS_DESCR),
@ApiImplicitParam(name = "types", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.TYPE, required = false,
value = ParameterDescriptions.TYPES_DESCR),
@ApiImplicitParam(name = "keys", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.BUILDING_KEY, required = false,
value = ParameterDescriptions.KEYS_DESCR),
@ApiImplicitParam(name = "values", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.RESIDENTIAL_VALUE, required = false,
value = ParameterDescriptions.VALUES_DESCR),
@ApiImplicitParam(name = "userids", paramType = "form", dataType = "string", required = false,
value = ParameterDescriptions.USERIDS_DESCR),
@ApiImplicitParam(name = "time", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.TIME, required = false,
value = ParameterDescriptions.TIME_DESCR),
@ApiImplicitParam(name = "format", paramType = "form", dataType = "string", required = false,
value = ParameterDescriptions.FORMAT_DESCR),
@ApiImplicitParam(name = "showMetadata", paramType = "form", dataType = "string",
defaultValue = DefaultSwaggerParameters.SHOW_METADATA, required = false,
value = ParameterDescriptions.SHOW_METADATA_DESCR)})
@RequestMapping(value = "/density/groupBy/boundary", method = RequestMethod.POST,
produces = "application/json", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public Response postCountDensityGroupByBoundary(String bboxes, String bcircles, String bpolys,
String[] types, String[] keys, String[] values, String[] userids, String[] time,
String format, String showMetadata)
throws UnsupportedOperationException, Exception, BadRequestException {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaGroupByBoundary(
RequestResource.COUNT, RequestParameters.of(true, true, true, bboxes, bcircles, bpolys,
types, keys, values, userids, time, format, showMetadata));
}

/**
* POST request giving the density of selected items (number of items per square-kilometers)
* grouped by the tag. POST requests should only be used if the request URL would be too long for
Expand Down
Loading

0 comments on commit 541ebe0

Please sign in to comment.