Skip to content

Commit 5b62ea4

Browse files
authored
Merge pull request pdssp#14 from Geomatys/chore/upgrade-dependencies
Fix pdssp#10 + global dependency update + minor API improvements
2 parents 560dc59 + 7b20146 commit 5b62ea4

File tree

5 files changed

+58
-10
lines changed

5 files changed

+58
-10
lines changed

build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131
compileOnly("org.jspecify:jspecify:1.0.0")
3232

3333
// Referencing engine
34-
implementation("org.apache.sis.core:sis-referencing:1.5.0-ALPHA-1")
34+
implementation(libs.apache.sis.referencing)
3535
implementation("org.apache.sis.non-free:sis-embedded-data:1.3")
3636
implementation("org.apache.sis.non-free:sis-epsg:1.3")
3737
implementation("org.apache.derby:derby")
@@ -41,7 +41,7 @@ dependencies {
4141
// For client
4242
testFixturesImplementation(platform(libs.geomatys.backend.bom))
4343
testFixturesImplementation("org.springframework:spring-core")
44-
testFixturesApi("org.apache.sis.core:sis-referencing:1.5.0-ALPHA-1")
44+
testFixturesApi(libs.apache.sis.referencing)
4545
testFixturesImplementation("org.graalvm.js:js:24.1.1")
4646
testFixturesImplementation("org.graalvm.js:js-scriptengine:24.1.1")
4747
testFixturesImplementation("org.python:jython-slim:2.7.4")
@@ -50,9 +50,9 @@ dependencies {
5050
testImplementation("org.iogp:gigs:1.0-GEOMATYS-ALPHA-1")
5151

5252
// For Swagger UI
53-
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0")
54-
implementation("com.github.therapi:therapi-runtime-javadoc:0.15.0")
55-
annotationProcessor("com.github.therapi:therapi-runtime-javadoc-scribe:0.13.0")
53+
implementation(libs.springdoc.starter)
54+
implementation(libs.therapi.runtime)
55+
annotationProcessor(libs.therapi.processor)
5656
}
5757

5858
tasks.withType<AsciidoctorTask> {

gradle/libs.versions.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
[versions]
2-
geomatys-backend = "2024.5"
2+
geomatys-backend = "2025.1"
3+
springdoc = "2.8.9"
4+
therapi = "0.15.0"
5+
apache-sis = "1.5.0-ALPHA-2"
36

47
[libraries]
8+
apache-sis-referencing = { module = "org.apache.sis.core:sis-referencing", version.ref = "apache-sis" }
59
geomatys-backend-bom = { module = "com.geomatys.backend:downstream-bom", version.ref = "geomatys-backend" }
10+
springdoc-starter = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" }
11+
therapi-runtime = { module = "com.github.therapi:therapi-runtime-javadoc", version.ref = "therapi" }
12+
therapi-processor = { module = "com.github.therapi:therapi-runtime-javadoc-scribe", version.ref = "therapi" }
613

714
[plugins]
815
geomatys-boot-convention = { id = "com.geomatys.spring-boot-convention", version.ref = "geomatys-backend" }

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import io.swagger.v3.oas.annotations.media.Schema;
2525
import java.time.OffsetDateTime;
2626
import org.springframework.core.io.Resource;
27+
import org.springframework.http.MediaType;
2728
import org.springframework.http.ResponseEntity;
2829
import org.springframework.web.bind.annotation.CrossOrigin;
2930
import org.springframework.web.bind.annotation.RequestBody;
@@ -53,7 +54,7 @@ public CRSOperationController(CrsOperationService service) {
5354
@CrossOrigin
5455
@RequestMapping(path = "define", method = RequestMethod.GET)
5556
@Parameter(name = "source", example = "EPSG:3395")
56-
@Parameter(name = "format", schema = @Schema(type = "string", allowableValues = {"application/json"}))
57+
@Parameter(name = "format", schema = @Schema(type = "string", allowableValues = {"application/json", "application/wkt"}))
5758
public ResponseEntity<Resource> getCRS(
5859
@RequestParam String source,
5960
@RequestParam(required = false, defaultValue = "false") boolean longitudeFirst,
@@ -107,7 +108,7 @@ public ResponseEntity<Resource> getOperation(
107108
* Parameters should be passed in json.
108109
*/
109110
@CrossOrigin
110-
@RequestMapping(path = "operation", method = RequestMethod.POST)
111+
@RequestMapping(path = "operation", method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_YAML_VALUE })
111112
public ResponseEntity<Resource> getOperation(@RequestBody CrsOperationService.OperationParameters parameters) {
112113
var result = service.getOperation(parameters);
113114
return ResponseEntity.ok()

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

Lines changed: 6 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
}
@@ -475,6 +478,8 @@ private static String toPythonClass(MathTransform trs) {
475478
pythonCode = pythonCode.replaceAll("β", "beta");
476479
//replace ρ
477480
pythonCode = pythonCode.replaceAll("ρ", "rho");
481+
//replace Ω
482+
pythonCode = pythonCode.replaceAll("Ω", "omega");
478483

479484
{//replace NaN
480485
final Pattern objPattern = Pattern.compile("(Number.math.NaN|Number.NaN|NaN)");

src/test/java/com/geomatys/crsservice/client/ClientTest.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
/**
1919
*
20-
* @author jsorel
20+
* @author Johann Sorel (Geomatys)
2121
*/
2222
public class ClientTest extends AbstractIntegrationTest {
2323

@@ -43,6 +43,41 @@ public void operationTest() throws Exception {
4343
testTransform(factory, "EPSG:4326", "EPSG:2154", new double[]{48, 2}, true, cartTolerance, geogTolerance);
4444
//Geocentric
4545
testTransform(factory, "EPSG:4326", "EPSG:4978", new double[]{48, 2}, true, cartTolerance, geogTolerance);
46+
//Spherical to projection
47+
final String mars1 =
48+
"GEODCRS[\"Mars (2015) / Ocentric\",\n" +
49+
" DATUM[\"Mars (2015)\",\n" +
50+
" ELLIPSOID[\"Mars (2015)\", 3396190, 169.8944472236118,\n" +
51+
" LENGTHUNIT[\"metre\", 1, ID[\"EPSG\", 9001]]],\n" +
52+
" ANCHOR[\"Viking 1 lander : 47.95137 W\"]],\n" +
53+
" PRIMEM[\"Reference Meridian\", 0,\n" +
54+
" ANGLEUNIT[\"degree\", 0.0174532925199433, ID[\"EPSG\", 9122]]],\n" +
55+
" CS[spherical, 2],\n" +
56+
" AXIS[\"planetocentric latitude (U)\", north,\n" +
57+
" ANGLEUNIT[\"degree\", 0.0174532925199433]],\n" +
58+
" AXIS[\"planetocentric longitude (V)\", east,\n" +
59+
" ANGLEUNIT[\"degree\", 0.0174532925199433]],\n" +
60+
" ID[\"IAU\", 49902, 2015],\n" +
61+
" REMARK[\"Source of IAU Coordinate systems: doi:10.1007/s10569-017-9805-5\"]]";
62+
final String mars2 =
63+
"PROJCRS[\"Mars (2015) / Ocentric / Equirectangular, clon = 0\",\n" +
64+
" BASEGEODCRS[\"Mars (2015) / Ocentric\",\n" +
65+
" DATUM[\"Mars (2015)\",\n" +
66+
" ELLIPSOID[\"Mars (2015)\", 3396190, 169.8944472236118,\n" +
67+
" LENGTHUNIT[\"metre\", 1, ID[\"EPSG\", 9001]]],\n" +
68+
" ANCHOR[\"Viking 1 lander : 47.95137 W\"]],\n" +
69+
" PRIMEM[\"Reference Meridian\", 0,\n" +
70+
" ANGLEUNIT[\"degree\", 0.0174532925199433, ID[\"EPSG\", 9122]]],\n" +
71+
" ID[\"IAU\", 49902, 2015]],\n" +
72+
" CONVERSION[\"Equirectangular, clon = 0\",\n" +
73+
" METHOD[\"Equidistant Cylindrical\", ID[\"EPSG\", 1028]]],\n" +
74+
" CS[Cartesian, 2],\n" +
75+
" AXIS[\"Easting (E)\", east,\n" +
76+
" LENGTHUNIT[\"metre\", 1]],\n" +
77+
" AXIS[\"Northing (N)\", north,\n" +
78+
" LENGTHUNIT[\"metre\", 1]],\n" +
79+
" ID[\"IAU\", 49912, 2015]]";
80+
testTransform(factory, mars1, mars2, new double[]{40, 120}, true, cartTolerance, geogTolerance);
4681

4782
//test PassThroughTransform : Not working yet
4883
CoordinateReferenceSystem crs1 = CRS.compound(CRS.forCode("CRS:84"));

0 commit comments

Comments
 (0)