Skip to content

Commit 9dbd443

Browse files
committed
feat: add correct geoparquet crs EPGS4226 specification
1 parent 22e8b2c commit 9dbd443

1 file changed

Lines changed: 42 additions & 1 deletion

File tree

ohsome-parquet/src/main/java/org/heigit/ohsome/parquet/GeoParquet.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,40 @@
1010

1111
public class GeoParquet<T> {
1212

13+
private static final String CRS_EPSG_4326 = """
14+
{
15+
"$schema": "https://proj.org/schemas/v0.7/projjson.schema.json",
16+
"type": "GeographicCRS",
17+
"name": "WGS 84",
18+
"datum_ensemble": {
19+
"name": "World Geodetic System 1984 ensemble",
20+
"members": [
21+
{ "name": "World Geodetic System 1984 (Transit)", "id": { "authority": "EPSG", "code": 1166 }},
22+
{ "name": "World Geodetic System 1984 (G730)", "id": { "authority": "EPSG", "code": 1152 }},
23+
{ "name": "World Geodetic System 1984 (G873)", "id": { "authority": "EPSG", "code": 1153 }},
24+
{ "name": "World Geodetic System 1984 (G1150)", "id": { "authority": "EPSG", "code": 1154 }},
25+
{ "name": "World Geodetic System 1984 (G1674)", "id": { "authority": "EPSG", "code": 1155 }},
26+
{ "name": "World Geodetic System 1984 (G1762)", "id": { "authority": "EPSG", "code": 1156 }},
27+
{ "name": "World Geodetic System 1984 (G2139)", "id": { "authority": "EPSG", "code": 1309 }},
28+
{ "name": "World Geodetic System 1984 (G2296)", "id": { "authority": "EPSG", "code": 1383 }},
29+
],
30+
"ellipsoid": { "name": "WGS 84", "semi_major_axis": 6378137, "inverse_flattening": 298.257223563 },
31+
"accuracy": "2.0",
32+
"id": {"authority": "EPSG", "code": 6326}
33+
},
34+
"coordinate_system": {
35+
"subtype": "ellipsoidal",
36+
"axis": [
37+
{ "name": "Geodetic latitude", "abbreviation": "Lat", "direction": "north", "unit": "degree" },
38+
{ "name": "Geodetic longitude", "abbreviation": "Lon", "direction": "east", "unit": "degree" },
39+
]
40+
},
41+
"scope": "Horizontal component of 3D system.",
42+
"area": "World.",
43+
"bbox": { "south_latitude": -90, "west_longitude": -180, "north_latitude": 90, "east_longitude": 180 },
44+
"id": {"authority": "EPSG", "code": 4326},
45+
}""";
46+
1347
public static class GeoParquetBuilder<T> {
1448
private final List<Column<T>> columns = new ArrayList<>();
1549

@@ -76,9 +110,16 @@ private String geometryTypeString() {
76110
}
77111

78112
public String print(Envelope bbox) {
79-
return "\"%s\": { \"encoding\": \"%s\", \"bbox\": %s%s, \"geometry_types\": %s }".formatted(
113+
return """
114+
"%s": {
115+
"encoding": "%s",
116+
"crs": %s,
117+
"bbox": %s%s,
118+
"geometry_types": %s
119+
}""".formatted(
80120
name,
81121
encoding.schema(),
122+
CRS_EPSG_4326,
82123
"[%s, %s, %s, %s]".formatted(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY()),
83124
covering == null ? "" : ", \"covering\": { %s }".formatted(coveringString()),
84125
geometryTypeString());

0 commit comments

Comments
 (0)