Skip to content

Commit 93de217

Browse files
authored
Store the PROJJSON representation of ogc-84 crs (#606)
In pyodide, the pyproj PROJ data directory is much smaller, and it currently hard-crashes on the line `pyproj.CRS("ogc:84")`. Instead, we vendor the PROJJSON representation of this CRS, which works in pyodide.
1 parent 99e2efa commit 93de217

File tree

1 file changed

+77
-1
lines changed

1 file changed

+77
-1
lines changed

lonboard/_constants.py

+77-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,83 @@
33
import pyproj
44

55
EPSG_4326 = pyproj.CRS("epsg:4326")
6-
OGC_84 = pyproj.CRS("ogc:84")
6+
7+
# In pyodide, the pyproj PROJ data directory is much smaller, and it currently
8+
# hard-crashes on the line `pyproj.CRS("ogc:84")`. Instead, we vendor the PROJJSON
9+
# representation of this CRS, which works in pyodide.
10+
OGC_84_dict = {
11+
"$schema": "https://proj.org/schemas/v0.7/projjson.schema.json",
12+
"type": "GeographicCRS",
13+
"name": "WGS 84 (CRS84)",
14+
"datum_ensemble": {
15+
"name": "World Geodetic System 1984 ensemble",
16+
"members": [
17+
{
18+
"name": "World Geodetic System 1984 (Transit)",
19+
"id": {"authority": "EPSG", "code": 1166},
20+
},
21+
{
22+
"name": "World Geodetic System 1984 (G730)",
23+
"id": {"authority": "EPSG", "code": 1152},
24+
},
25+
{
26+
"name": "World Geodetic System 1984 (G873)",
27+
"id": {"authority": "EPSG", "code": 1153},
28+
},
29+
{
30+
"name": "World Geodetic System 1984 (G1150)",
31+
"id": {"authority": "EPSG", "code": 1154},
32+
},
33+
{
34+
"name": "World Geodetic System 1984 (G1674)",
35+
"id": {"authority": "EPSG", "code": 1155},
36+
},
37+
{
38+
"name": "World Geodetic System 1984 (G1762)",
39+
"id": {"authority": "EPSG", "code": 1156},
40+
},
41+
{
42+
"name": "World Geodetic System 1984 (G2139)",
43+
"id": {"authority": "EPSG", "code": 1309},
44+
},
45+
],
46+
"ellipsoid": {
47+
"name": "WGS 84",
48+
"semi_major_axis": 6378137,
49+
"inverse_flattening": 298.257223563,
50+
},
51+
"accuracy": "2.0",
52+
"id": {"authority": "EPSG", "code": 6326},
53+
},
54+
"coordinate_system": {
55+
"subtype": "ellipsoidal",
56+
"axis": [
57+
{
58+
"name": "Geodetic longitude",
59+
"abbreviation": "Lon",
60+
"direction": "east",
61+
"unit": "degree",
62+
},
63+
{
64+
"name": "Geodetic latitude",
65+
"abbreviation": "Lat",
66+
"direction": "north",
67+
"unit": "degree",
68+
},
69+
],
70+
},
71+
"scope": "Not known.",
72+
"area": "World.",
73+
"bbox": {
74+
"south_latitude": -90,
75+
"west_longitude": -180,
76+
"north_latitude": 90,
77+
"east_longitude": 180,
78+
},
79+
"id": {"authority": "OGC", "code": "CRS84"},
80+
}
81+
82+
OGC_84 = pyproj.CRS.from_json_dict(OGC_84_dict)
783

884

985
class EXTENSION_NAME(bytes, Enum):

0 commit comments

Comments
 (0)