Skip to content

Commit

Permalink
including /share processing in ratio computation
Browse files Browse the repository at this point in the history
as /share is only a special case of /ratio and this is now possible with the new ratio implementation
  • Loading branch information
kowatsch committed May 24, 2018
1 parent 87a84d4 commit 6164ef8
Show file tree
Hide file tree
Showing 14 changed files with 268 additions and 377 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.executor.RequestResource;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.exception.BadRequestException;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.DefaultAggregationResponse;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioResponse;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.elements.ShareResponse;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioShareResponse;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.GroupByResponse;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.RatioGroupByBoundaryResponse;
import org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.ShareGroupByBoundaryResponse;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand Down Expand Up @@ -303,8 +300,8 @@ RequestResource.AREA, new RequestParameters(false, true, false, bboxes, bcircles
* subgroup(share).
* @param values2 <code>String</code> array having the same format as values and used to define
* the subgroup(share).
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.elements.ShareResponse
* ShareResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.elements.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(
value = "Share of area of elements satisfying keys2 and values2 within elements selected by types, keys and values")
Expand All @@ -314,7 +311,7 @@ RequestResource.AREA, new RequestParameters(false, true, false, bboxes, bcircles
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share", method = RequestMethod.GET, produces = "application/json")
public ShareResponse getAreaShare(
public RatioShareResponse getAreaShare(
@ApiParam(hidden = true) @RequestParam(value = "bboxes", defaultValue = "",
required = false) String bboxes,
@ApiParam(hidden = true) @RequestParam(value = "bcircles", defaultValue = "",
Expand All @@ -337,10 +334,11 @@ public ShareResponse getAreaShare(
@RequestParam(value = "values2", defaultValue = "", required = false) String[] values2)
throws UnsupportedOperationException, Exception {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaShare(RequestResource.AREA,
new RequestParameters(false, true, false, bboxes, bcircles, bpolys, types, keys, values,
userids, time, showMetadata),
keys2, values2);
return ElementsRequestExecutor
.executeCountLengthPerimeterAreaRatio(
RequestResource.AREA, new RequestParameters(false, true, false, bboxes, bcircles,
bpolys, types, keys, values, userids, time, showMetadata),
types, keys2, values2, true);
}

/**
Expand All @@ -355,8 +353,8 @@ public ShareResponse getAreaShare(
* subgroup(share).
* @param values2 <code>String</code> array having the same format as values and used to define
* the subgroup(share).
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.ShareGroupByBoundaryResponse
* ShareGroupByBoundaryResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(value = "Share results of OSM elements grouped by the boundary")
@ApiImplicitParams({
Expand All @@ -366,7 +364,7 @@ public ShareResponse getAreaShare(
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share/groupBy/boundary", method = RequestMethod.GET,
produces = "application/json")
public ShareGroupByBoundaryResponse getAreaShareGroupByBoundary(
public RatioShareResponse getAreaShareGroupByBoundary(
@ApiParam(hidden = true) @RequestParam(value = "bboxes", defaultValue = "",
required = false) String bboxes,
@ApiParam(hidden = true) @RequestParam(value = "bcircles", defaultValue = "",
Expand Down Expand Up @@ -542,8 +540,8 @@ public GroupByResponse getAreaDensityGroupByTag(
* @param types2 <code>String</code> array having the same format as types.
* @param keys2 <code>String</code> array having the same format as keys.
* @param values2 <code>String</code> array having the same format as values.
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioResponse
* RatioResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(
value = "Ratio of selected items satisfying types2, keys2 and values2 within items selected by types, keys and values")
Expand All @@ -556,7 +554,7 @@ public GroupByResponse getAreaDensityGroupByTag(
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/ratio", method = RequestMethod.GET, produces = "application/json")
public RatioResponse getAreaRatio(
public RatioShareResponse getAreaRatio(
@ApiParam(hidden = true) @RequestParam(value = "bboxes", defaultValue = "",
required = false) String bboxes,
@ApiParam(hidden = true) @RequestParam(value = "bcircles", defaultValue = "",
Expand All @@ -580,10 +578,11 @@ public RatioResponse getAreaRatio(
@RequestParam(value = "values2", defaultValue = "", required = false) String[] values2)
throws UnsupportedOperationException, Exception {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatio(RequestResource.AREA,
new RequestParameters(false, true, false, bboxes, bcircles, bpolys, types, keys, values,
userids, time, showMetadata),
types2, keys2, values2);
return ElementsRequestExecutor
.executeCountLengthPerimeterAreaRatio(
RequestResource.AREA, new RequestParameters(false, true, false, bboxes, bcircles,
bpolys, types, keys, values, userids, time, showMetadata),
types2, keys2, values2, false);
}

/**
Expand All @@ -594,8 +593,8 @@ public RatioResponse getAreaRatio(
* {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.dataAggregation.CountController#getCountRatio(String, String, String, String[], String[], String[], String[], String[], String, String[], String[], String[])
* getCountRatio} method.
*
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioResponse
* RatioResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(value = "Ratio of the area of selected items grouped by the boundary")
@ApiImplicitParams({
Expand All @@ -609,7 +608,7 @@ public RatioResponse getAreaRatio(
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/ratio/groupBy/boundary", method = RequestMethod.GET,
produces = "application/json")
public RatioGroupByBoundaryResponse getAreaRatioGroupByBoundary(
public RatioShareResponse getAreaRatioGroupByBoundary(
@ApiParam(hidden = true) @RequestParam(value = "bboxes", defaultValue = "",
required = false) String bboxes,
@ApiParam(hidden = true) @RequestParam(value = "bcircles", defaultValue = "",
Expand Down Expand Up @@ -958,8 +957,8 @@ public GroupByResponse postAreaGroupByTag(String bboxes, String bcircles, String
* subgroup(share).
* @param values2 <code>String</code> array having the same format as values and used to define
* the subgroup(share).
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.elements.ShareResponse
* ShareResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.elements.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(
value = "Share of area of elements satisfying keys2 and values2 within elements selected by types, keys and values")
Expand Down Expand Up @@ -995,15 +994,15 @@ public GroupByResponse postAreaGroupByTag(String bboxes, String bcircles, String
value = ParameterDescriptions.VALUES_DESCR)})
@RequestMapping(value = "/share", method = RequestMethod.POST, produces = "application/json",
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public ShareResponse postAreaShare(String bboxes, String bcircles, String bpolys, String[] types,
String[] keys, String[] values, String[] userids, String[] time, String showMetadata,
String[] keys2, String[] values2)
public RatioShareResponse postAreaShare(String bboxes, String bcircles, String bpolys,
String[] types, String[] keys, String[] values, String[] userids, String[] time,
String showMetadata, String[] keys2, String[] values2)
throws UnsupportedOperationException, Exception, BadRequestException {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaShare(RequestResource.AREA,
return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatio(RequestResource.AREA,
new RequestParameters(true, true, false, bboxes, bcircles, bpolys, types, keys, values,
userids, time, showMetadata),
keys2, values2);
types, keys2, values2, true);
}

/**
Expand All @@ -1019,8 +1018,8 @@ public ShareResponse postAreaShare(String bboxes, String bcircles, String bpolys
* subgroup(share).
* @param values2 <code>String</code> array having the same format as values and used to define
* the subgroup(share).
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.ShareGroupByBoundaryResponse
* ShareGroupByBoundaryResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.groupByResponse.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(value = "Share results of OSM elements grouped by the boundary")
@ApiImplicitParams({
Expand Down Expand Up @@ -1055,7 +1054,7 @@ public ShareResponse postAreaShare(String bboxes, String bcircles, String bpolys
value = ParameterDescriptions.VALUES_DESCR)})
@RequestMapping(value = "/share/groupBy/boundary", method = RequestMethod.POST,
produces = "application/json", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public ShareGroupByBoundaryResponse postAreaShareGroupByBoundary(String bboxes, String bcircles,
public RatioShareResponse postAreaShareGroupByBoundary(String bboxes, String bcircles,
String bpolys, String[] types, String[] keys, String[] values, String[] userids,
String[] time, String showMetadata, String[] keys2, String[] values2)
throws UnsupportedOperationException, Exception, BadRequestException {
Expand Down Expand Up @@ -1236,8 +1235,8 @@ public GroupByResponse postAreaDensityGroupByTag(String bboxes, String bcircles,
* @param types2 <code>String</code> array having the same format as types.
* @param keys2 <code>String</code> array having the same format as keys.
* @param values2 <code>String</code> array having the same format as values.
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioResponse
* RatioResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(
value = "Ratio of selected items satisfying types2, keys2 and values2 within items selected by types, keys and values")
Expand Down Expand Up @@ -1274,15 +1273,15 @@ public GroupByResponse postAreaDensityGroupByTag(String bboxes, String bcircles,
defaultValue = "", required = false, value = ParameterDescriptions.VALUES_DESCR)})
@RequestMapping(value = "/ratio", method = RequestMethod.POST, produces = "application/json",
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public RatioResponse postAreaRatio(String bboxes, String bcircles, String bpolys, String[] types,
String[] keys, String[] values, String[] userids, String[] time, String showMetadata,
String[] types2, String[] keys2, String[] values2)
public RatioShareResponse postAreaRatio(String bboxes, String bcircles, String bpolys,
String[] types, String[] keys, String[] values, String[] userids, String[] time,
String showMetadata, String[] types2, String[] keys2, String[] values2)
throws UnsupportedOperationException, Exception, BadRequestException {

return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatio(RequestResource.AREA,
new RequestParameters(true, true, false, bboxes, bcircles, bpolys, types, keys, values,
userids, time, showMetadata),
types2, keys2, values2);
types2, keys2, values2, false);
}

/**
Expand All @@ -1294,8 +1293,8 @@ public RatioResponse postAreaRatio(String bboxes, String bcircles, String bpolys
* {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.controller.dataAggregation.CountController#getCountRatio(String, String, String, String[], String[], String[], String[], String[], String, String[], String[], String[])
* getCountRatio} method.
*
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioResponse
* RatioResponse}
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeApi.output.dataAggregationResponse.RatioShareResponse
* RatioShareResponse}
*/
@ApiOperation(value = "Ratio of the area of selected items grouped by the boundary")
@ApiImplicitParams({
Expand Down Expand Up @@ -1331,7 +1330,7 @@ public RatioResponse postAreaRatio(String bboxes, String bcircles, String bpolys
defaultValue = "", required = false, value = ParameterDescriptions.VALUES_DESCR)})
@RequestMapping(value = "/ratio/groupBy/boundary", method = RequestMethod.POST,
produces = "application/json", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public RatioGroupByBoundaryResponse postAreaRatioGroupByBoundary(String bboxes, String bcircles,
public RatioShareResponse postAreaRatioGroupByBoundary(String bboxes, String bcircles,
String bpolys, String[] types, String[] keys, String[] values, String[] userids,
String[] time, String showMetadata, String[] types2, String[] keys2, String[] values2)
throws UnsupportedOperationException, Exception {
Expand Down
Loading

0 comments on commit 6164ef8

Please sign in to comment.