Skip to content

Commit

Permalink
Merge branch 'remove-share-resource' into 'master'
Browse files Browse the repository at this point in the history
Remove share resource

See merge request giscience/big-data/ohsome/ohsome-api!33
  • Loading branch information
tyrasd committed Feb 13, 2020
2 parents 0ba3523 + 1b6c78d commit 452ea66
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 952 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.heigit.bigspatialdata.ohsome.ohsomeapi;

import com.zaxxer.hikari.HikariConfig;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.heigit.bigspatialdata.ohsome.ohsomeapi.inputprocessing.ProcessingData;
Expand All @@ -17,7 +18,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import com.zaxxer.hikari.HikariConfig;


/**
* Main class, which is used to run this Spring boot application. Establishes a connection to the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.heigit.bigspatialdata.ohsome.ohsomeapi.controller.dataaggregation;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
Expand All @@ -13,10 +14,8 @@
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.Response;
import org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.elements.ShareResponse;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -155,56 +154,6 @@ public Response areaGroupByTag(HttpServletRequest servletRequest,
servletRequest, servletResponse, true, false);
}

/**
* Gives the area of items satisfying keys, values (plus other parameters) and part of items
* satisfying keys2, values2 (plus other parameters).
*
* @param servletRequest <code>HttpServletRequest</code> of the incoming request
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.Response
* Response}
*/
@ApiOperation(
value = "Share of area of elements satisfying keys2 and values2 "
+ "within elements selected by types, keys and values",
nickname = "areaShare", response = ShareResponse.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "keys2", value = ParameterDescriptions.KEYS_DESCR,
defaultValue = "addr:street", paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share", method = {RequestMethod.GET, RequestMethod.POST},
produces = {"application/json", "text/csv"})
public Response areaShare(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatio(RequestResource.AREA,
servletRequest, servletResponse, true, false, true);
}

/**
* Gives the area of items satisfying keys, values (plus other parameters) and part of items
* satisfying keys2, values2 (plus other parameters), grouped by the boundary.
*
* @param servletRequest <code>HttpServletRequest</code> of the incoming request
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.Response
* Response}
*/
@ApiOperation(value = "Share results of OSM elements grouped by the boundary",
nickname = "areaShareGroupByBoundary", response = ShareGroupByBoundaryResponse.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "keys2", value = ParameterDescriptions.KEYS_DESCR,
defaultValue = "addr:street", paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share/groupBy/boundary",
method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json", "text/csv"})
public Response areaShareGroupByBoundary(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatioGroupByBoundary(
RequestResource.AREA, servletRequest, servletResponse, true, false, true);
}

/**
* Gives the density of OSM elements (area of items divided by the total area in
* square-kilometers).
Expand Down Expand Up @@ -337,8 +286,8 @@ public Response areaDensityGroupByTag(HttpServletRequest servletRequest,
produces = {"application/json", "text/csv"})
public Response areaRatio(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatio(RequestResource.AREA,
servletRequest, servletResponse, true, false, false);
return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatio(RequestResource.AREA,
servletRequest, servletResponse, true, false);
}

/**
Expand All @@ -365,7 +314,7 @@ public Response areaRatio(HttpServletRequest servletRequest, HttpServletResponse
method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json", "text/csv"})
public Response areaRatioGroupByBoundary(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatioGroupByBoundary(
RequestResource.AREA, servletRequest, servletResponse, true, false, false);
return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatioGroupByBoundary(
RequestResource.AREA, servletRequest, servletResponse, true, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
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.Response;
import org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.elements.ShareResponse;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -160,58 +158,6 @@ public Response countGroupByTag(HttpServletRequest servletRequest,
servletRequest, servletResponse, true, false);
}

/**
* Gives the share of OSM elements satisfying keys2 and values2 within items selected by types,
* keys and values.
*
* @param servletRequest <code>HttpServletRequest</code> of the incoming request
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.Response
* Response}
*/
@ApiOperation(
value = "Share of count of elements satisfying keys2 and values2 "
+ "within elements selected by types, keys and values",
nickname = "countShare", response = ShareResponse.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "keys2", value = ParameterDescriptions.KEYS_DESCR,
defaultValue = "maxspeed", paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share", method = {RequestMethod.GET, RequestMethod.POST},
produces = {"application/json", "text/csv"})
public Response countShare(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatio(RequestResource.COUNT,
servletRequest, servletResponse, true, false, true);
}

/**
* Gives the share of OSM elements satisfying keys2 and values2 within items selected by types,
* keys and values grouped by the boundary.
*
* @param servletRequest <code>HttpServletRequest</code> of the incoming request
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.Response
* Response}
*/
@ApiOperation(value = "Share results of OSM elements grouped by the boundary",
nickname = "countShareGroupByBoundary", response = ShareGroupByBoundaryResponse.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "keys2", value = ParameterDescriptions.KEYS_DESCR, defaultValue = "",
paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "format", value = ParameterDescriptions.FORMAT_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false),
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share/groupBy/boundary",
method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json", "text/csv"})
public Response countShareGroupByBoundary(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatioGroupByBoundary(
RequestResource.COUNT, servletRequest, servletResponse, true, false, true);
}

/**
* Gives the density of OSM elements (number of items divided by the total area in
* square-kilometers).
Expand Down Expand Up @@ -346,8 +292,8 @@ public Response countDensityGroupByTag(HttpServletRequest servletRequest,
produces = {"application/json", "text/csv"})
public Response countRatio(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatio(RequestResource.COUNT,
servletRequest, servletResponse, true, false, false);
return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatio(RequestResource.COUNT,
servletRequest, servletResponse, true, false);
}

/**
Expand Down Expand Up @@ -375,7 +321,7 @@ public Response countRatio(HttpServletRequest servletRequest, HttpServletRespons
method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json", "text/csv"})
public Response countRatioGroupByBoundary(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatioGroupByBoundary(
RequestResource.COUNT, servletRequest, servletResponse, true, false, false);
return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatioGroupByBoundary(
RequestResource.COUNT, servletRequest, servletResponse, true, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
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.Response;
import org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.elements.ShareResponse;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -157,58 +155,6 @@ public Response lengthGroupByTag(HttpServletRequest servletRequest,
servletRequest, servletResponse, true, false);
}

/**
* Gives the length of items satisfying keys, values (+ other params) and part of items satisfying
* keys2, values2.(+ other params).
*
* @param servletRequest <code>HttpServletRequest</code> of the incoming request
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.Response
* Response}
*/
@ApiOperation(
value = "Share of length of elements satisfying keys2 and values2 "
+ "within elements selected by types, keys and values",
nickname = "lengthShare", response = ShareResponse.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "keys2", value = ParameterDescriptions.KEYS_DESCR,
defaultValue = "maxspeed", paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share", method = {RequestMethod.GET, RequestMethod.POST},
produces = {"application/json", "text/csv"})
public Response lengthShare(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatio(RequestResource.LENGTH,
servletRequest, servletResponse, true, false, true);
}

/**
* Gives the length of items satisfying keys, values (+ other params) and part of items satisfying
* keys2, values2 (plus other parameters), grouped by the boundary.
*
* @param servletRequest <code>HttpServletRequest</code> of the incoming request
* @param servletResponse <code>HttpServletResponse</code> of the outgoing response
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataaggregationresponse.Response
* Response}
*/
@ApiOperation(value = "Share results of OSM elements grouped by the boundary",
nickname = "lengthShareGroupByBoundary", response = ShareGroupByBoundaryResponse.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "format", value = ParameterDescriptions.FORMAT_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false),
@ApiImplicitParam(name = "keys2", value = ParameterDescriptions.KEYS_DESCR,
defaultValue = "maxspeed", paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "values2", value = ParameterDescriptions.VALUES_DESCR,
defaultValue = "", paramType = "query", dataType = "string", required = false)})
@RequestMapping(value = "/share/groupBy/boundary",
method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json", "text/csv"})
public Response lengthShareGroupByBoundary(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatioGroupByBoundary(
RequestResource.LENGTH, servletRequest, servletResponse, true, false, true);
}

/**
* Gives the density of OSM elements (length of items divided by the total area in
* square-kilometers).
Expand Down Expand Up @@ -341,8 +287,8 @@ public Response lengthDensityGroupByTag(HttpServletRequest servletRequest,
produces = {"application/json", "text/csv"})
public Response lengthRatio(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatio(RequestResource.LENGTH,
servletRequest, servletResponse, true, false, false);
return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatio(RequestResource.LENGTH,
servletRequest, servletResponse, true, false);
}

/**
Expand Down Expand Up @@ -371,7 +317,7 @@ public Response lengthRatio(HttpServletRequest servletRequest,
method = {RequestMethod.GET, RequestMethod.POST}, produces = {"application/json", "text/csv"})
public Response lengthRatioGroupByBoundary(HttpServletRequest servletRequest,
HttpServletResponse servletResponse) throws Exception {
return ElementsRequestExecutor.executeCountLengthPerimeterAreaShareRatioGroupByBoundary(
RequestResource.LENGTH, servletRequest, servletResponse, true, false, false);
return ElementsRequestExecutor.executeCountLengthPerimeterAreaRatioGroupByBoundary(
RequestResource.LENGTH, servletRequest, servletResponse, true, false);
}
}
Loading

0 comments on commit 452ea66

Please sign in to comment.