Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove geographic_crs and update info model #746

Merged

Conversation

vincentsarago
Copy link
Member

second take at #744

This PR does:

  • removes min/max zoom from info() response breaking change
  • adds CRS (uri or wkt) in info() response
  • replaces geographic_bounds with dataset bounds in info() response breaking change
  • removes geographic_bounds property from Reader BaseClass breaking change
  • adds get_geographic_bounds(crs: CRS) method in BaseClass
  • removes geographic_crs attribute in BaseClass breaking change

This PR is less breaking than #745 and achieve the same result

@vincentsarago
Copy link
Member Author

with this PR, a tilejson.json endpoint in titiler will look like

@app.get(
    "/{tileMatrixSetId}/tilejson.json",
    response_model=TileJSON,
    responses={200: {"description": "Return a tilejson"}},
    response_model_exclude_none=True,
)
def tilejson(
    request: Request,
    tileMatrixSetId: Annotated[
        Literal[tuple(self.supported_tms.list())],
        Path(
            description="Identifier selecting one of the TileMatrixSetId supported."
        ),
    ],
):
    """Return TileJSON document for a dataset."""
    route_params = {
        "z": "{z}",
        "x": "{x}",
        "y": "{y}",
        "tileMatrixSetId": tileMatrixSetId,
    }
    tiles_url = self.url_for(request, "tile", **route_params)

    tms = self.supported_tms.get(tileMatrixSetId)
    
    with Reader("COG.tif", tms=tms) as src_dst:
        return {
            "bounds": src_dst.get_geographic_bounds(tms.rasterio_geographic_crs),
            "minzoom": src_dst.minzoom,
            "maxzoom": src_dst.maxzoom,
            "tiles": [tiles_url],
        }

@vincentsarago
Copy link
Member Author

would love to have your opinions @AndrewAnnex 🙏

@AndrewAnnex
Copy link
Contributor

@vincentsarago heh the time zones probably make this hard but just added a suggestion

@vincentsarago vincentsarago marked this pull request as ready for review October 10, 2024 09:51
@vincentsarago vincentsarago merged commit cd039d3 into main Oct 10, 2024
8 checks passed
@vincentsarago vincentsarago deleted the refactor/remove-geographic-crs-and-update-info-model branch October 10, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants