|
10 | 10 |
|
11 | 11 | public class GeoParquet<T> { |
12 | 12 |
|
| 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 | + |
13 | 47 | public static class GeoParquetBuilder<T> { |
14 | 48 | private final List<Column<T>> columns = new ArrayList<>(); |
15 | 49 |
|
@@ -76,9 +110,16 @@ private String geometryTypeString() { |
76 | 110 | } |
77 | 111 |
|
78 | 112 | 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( |
80 | 120 | name, |
81 | 121 | encoding.schema(), |
| 122 | + CRS_EPSG_4326, |
82 | 123 | "[%s, %s, %s, %s]".formatted(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY()), |
83 | 124 | covering == null ? "" : ", \"covering\": { %s }".formatted(coveringString()), |
84 | 125 | geometryTypeString()); |
|
0 commit comments