Skip to content

Commit ca772cb

Browse files
committed
feat(REST): allow to return full WKT definition for CRS definition endpoint
NOTE: Should be improved to ask either WKT v1 or v2.
1 parent 316ac96 commit ca772cb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/com/geomatys/crsservice/rest/CRSOperationController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public CRSOperationController(CrsOperationService service) {
5454
@CrossOrigin
5555
@RequestMapping(path = "define", method = RequestMethod.GET)
5656
@Parameter(name = "source", example = "EPSG:3395")
57-
@Parameter(name = "format", schema = @Schema(type = "string", allowableValues = {"application/json"}))
57+
@Parameter(name = "format", schema = @Schema(type = "string", allowableValues = {"application/json", "application/wkt"}))
5858
public ResponseEntity<Resource> getCRS(
5959
@RequestParam String source,
6060
@RequestParam(required = false, defaultValue = "false") boolean longitudeFirst,

src/main/java/com/geomatys/crsservice/service/DefaultCrsOperationService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ public SourceCode getCRS(CRSParameters request) throws IllegalArgumentException,
9797
);
9898

9999
} else if (FORMAT_WKT.equals(format)) {
100-
throw new UnsupportedOperationException("TODO");
100+
return new SourceCode(
101+
MediaType.parseMediaType(FORMAT_WKT + "; charset=utf-8"),
102+
new ByteArrayResource(crs.toWKT().getBytes(StandardCharsets.UTF_8))
103+
);
101104
} else {
102105
throw new IllegalArgumentException("Format not supported " + format);
103106
}

0 commit comments

Comments
 (0)