Skip to content

Commit 41bb265

Browse files
Merge pull request #31 from developmentseed/fixCRSInfo
switch from epsg4326 to CRS84
2 parents 9fbdb31 + 564f5ef commit 41bb265

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

tests/routes/test_collections.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ def test_collections_landsat(app):
114114
body = response.json()
115115
assert body["id"] == "public.landsat_wrs"
116116
assert ["id", "title", "links", "extent", "itemType", "crs"] == list(body)
117+
assert body["crs"] == ["http://www.opengis.net/def/crs/OGC/1.3/CRS84"]
117118
assert ["bbox", "crs"] == list(body["extent"]["spatial"])
119+
assert (
120+
body["extent"]["spatial"]["crs"]
121+
== "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
122+
)
118123
assert not body["extent"].get("temporal")
119124

120125
response = app.get("/collections/public.landsat_wrs?f=html")

tipg/dbmodel.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class Collection(BaseModel):
170170
@property
171171
def extent(self) -> Optional[Extent]:
172172
"""Return extent."""
173-
extent = {}
173+
extent: Dict[str, Any] = {}
174174
if cols := self.geometry_columns:
175175
if len(cols) == 1:
176176
bbox = [cols[0].bounds]
@@ -183,7 +183,9 @@ def extent(self) -> Optional[Extent]:
183183

184184
extent["spatial"] = {
185185
"bbox": bbox,
186-
"crs": f"http://www.opengis.net/def/crs/EPSG/0/{cols[0].srid}",
186+
# The extent calculated in Pg is in WGS84 LON,LAT order
187+
# so we use `CRS84` as CRS
188+
"crs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84",
187189
}
188190

189191
if cols := self.datetime_columns:

tipg/model.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Spatial(BaseModel):
4242
# extent of the data. All subsequent bounding boxes describe
4343
# more precise bounding boxes, e.g., to identify clusters of data.
4444
bbox: List[List[float]]
45-
crs: str
45+
crs: str = "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
4646

4747

4848
class Temporal(BaseModel):
@@ -76,6 +76,8 @@ class Extent(BaseModel):
7676
class Collection(BaseModel):
7777
"""Collection model.
7878
79+
Note: `CRS` is the list of CRS supported by the service not the CRS of the collection
80+
7981
Ref: http://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/collection.yaml
8082
8183
"""
@@ -86,7 +88,7 @@ class Collection(BaseModel):
8688
links: List[Link]
8789
extent: Optional[Extent]
8890
itemType: str = "feature"
89-
crs: List[str] = ["http://www.opengis.net/def/crs/EPSG/0/4326"]
91+
crs: List[str] = ["http://www.opengis.net/def/crs/OGC/1.3/CRS84"]
9092

9193
class Config:
9294
"""Collection model configuration."""

0 commit comments

Comments
 (0)