-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
via the resource /elements
- Loading branch information
Showing
4 changed files
with
222 additions
and
1 deletion.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...ava/org/heigit/bigspatialdata/ohsome/ohsomeapi/controller/rawData/ElementsController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package org.heigit.bigspatialdata.ohsome.ohsomeapi.controller.rawData; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import org.heigit.bigspatialdata.ohsome.ohsomeapi.executor.ElementsRequestExecutor; | ||
import org.heigit.bigspatialdata.ohsome.ohsomeapi.executor.RequestParameters; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import io.swagger.annotations.ApiParam; | ||
|
||
/** | ||
* REST controller containing the method, which is mapped to "/elements" and used to return OSM | ||
* data. | ||
*/ | ||
@Api(tags = "dataExtraction") | ||
@RestController | ||
@RequestMapping("/elements") | ||
public class ElementsController { | ||
|
||
/** | ||
* Gives raw OSM objects as GeoJSON features. | ||
* | ||
* <p> | ||
* The parameters are described in the | ||
* {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.controller.dataaggregation.CountController#count(String, String, String, String[], String[], String[], String[], String[], String, HttpServletRequest) | ||
* count} method. | ||
* | ||
* @return {@link org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataAggregationResponse.Response | ||
* Response} | ||
*/ | ||
@ApiOperation(value = "Raw OSM Data", nickname = "rawData") | ||
@RequestMapping(value = "", method = {RequestMethod.GET, RequestMethod.POST}) | ||
public void retrieveRawData( | ||
@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 = "showMetadata", | ||
defaultValue = "false") String showMetadata, | ||
@ApiParam(hidden = true) HttpServletRequest request, | ||
@ApiParam(hidden = true) HttpServletResponse response) | ||
throws UnsupportedOperationException, Exception { | ||
ElementsRequestExecutor.executeRetrieveRawData(new RequestParameters(request.getMethod(), true, | ||
false, bboxes, bcircles, bpolys, types, keys, values, userids, time, showMetadata), | ||
response); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
.../java/org/heigit/bigspatialdata/ohsome/ohsomeapi/output/rawDataResponse/DataResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.heigit.bigspatialdata.ohsome.ohsomeapi.output.rawDataResponse; | ||
|
||
import java.util.List; | ||
import org.wololo.geojson.Feature; | ||
import org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataAggregationResponse.Attribution; | ||
import org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataAggregationResponse.Metadata; | ||
import org.heigit.bigspatialdata.ohsome.ohsomeapi.output.dataAggregationResponse.Response; | ||
import io.swagger.annotations.ApiModelProperty; | ||
|
||
/** | ||
* Represents the whole GeoJSON response object for the /elements resource. | ||
*/ | ||
public class DataResponse implements Response { | ||
|
||
@ApiModelProperty(notes = "License and copyright info", required = true) | ||
private Attribution attribution; | ||
@ApiModelProperty(notes = "Version of this api", required = true) | ||
private String apiVersion; | ||
@ApiModelProperty(notes = "Metadata describing the output") | ||
private Metadata metadata; | ||
@ApiModelProperty(notes = "Type of the GeoJSON", required = true) | ||
private String type; | ||
@ApiModelProperty(notes = "List of GeoJSON features containing the OSM data") | ||
private List<Feature> features; | ||
|
||
public DataResponse(Attribution attribution, String apiVersion, Metadata metadata, String type, | ||
List<Feature> features) { | ||
this.attribution = attribution; | ||
this.apiVersion = apiVersion; | ||
this.metadata = metadata; | ||
this.type = type; | ||
this.features = features; | ||
} | ||
|
||
@Override | ||
public Attribution getAttribution() { | ||
return attribution; | ||
} | ||
|
||
@Override | ||
public String getApiVersion() { | ||
return apiVersion; | ||
} | ||
|
||
@Override | ||
public Metadata getMetadata() { | ||
return metadata; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public List<Feature> getFeatures() { | ||
return features; | ||
} | ||
} |