C Creating and Using Raster Tile Service for Web Application

This appendix describes the raster tile service for web applications with examples.

In modern web mapping and geospatial applications, large raster datasets are commonly served through web URLs as smaller and manageable pieces called raster tiles. This tiling approach allows efficient access and web-based delivery of imagery and raster data at various levels of detail, which also reduces the complexity of web application development. With the GeoRaster database, you can serve any imagery and raster data to the web using this tiling approach. For example, through this raster tile service, users can stream imagery and DEM rasters to the web for further processing and 3D visualizations. In the background, each raster tile in the service is built and served natively in the database from one or more GeoRaster objects, regardless of the underlying raster storage format.

A raster dataset is split into a grid of square tiles (commonly 256x256 pixels) across multiple zoom levels, each zoom level (z) increases the number of tiles exponentially following a 2^z x 2^z pattern. At zoom level zero, one tile covers the entire world. Given that the standard tiles are 256x256 pixels, the resolution of a pixel on the equator can be calculated by dividing the Earth's equatorial circumference by the tile's pixel dimension size. The resolution at zoom level zero is approximately 156,534 meters. At zoom level 22, the resolution of a pixel is approximately 3.7 centimeters per pixel.

In the Web Mercator projection, the resolution changes with latitude. The position of each tile within this grid is specified by its horizontal (x) and vertical (y) indices at the given zoom level. This addressing system, often referred to as the XYZ scheme (see OGC WebMercatorQuad at 17-083r4 specification document), enables users or applications to request only the specific tile needed for a particular map view and zoom setting.

For example, at zoom level 2 the raster is divided into 16 tiles (4 columns by 4 rows). A request for tile x=1, y=2, z=2, retrieves a specific section of the raster at the resolution with zoom level two. This approach greatly improves the performance and scalability of web mapping applications by optimizing image retrieval and display.

The SDO_GEOR_UTL.get_rasterTile function in Oracle AI Database can retrieve a specific raster tile from a virtual mosaic of one or more GeoRaster objects. Additionally, a REST endpoint can be created to retrieve that raster tile by specifying the zoom level (z) and the tile coordinates (x and y). This is particularly useful for displaying rasters stored in a database on an interactive map.

To implement the preceding functionality, Oracle REST Data Services (ORDS) can be used to create a REST endpoint to render raster tiles from GeoRaster objects stored in an Oracle AI Database.

For instance, consider the following REST endpoint created by ORDS:

GET /ords/scott/service1/vegetation/{z}/{x}/{y}

This endpoint internally calls the SDO_GEOR_UTL.get_rasterTile function.

The following two examples describe the tiling service using ORDS. Each example creates an endpoint that retrieves a virtual mosaic of multiple GeoRaster objects on a tile-by-tile basis. The created endpoints for these tiling services can be further used to setup raster layers in web applications using MapLibre or any other GIS systems that support a raster tile source.

Before proceeding, ensure that you meet following prerequisites:

  • ORDS is installed and configured. See Installing and Configuring Oracle REST Data Services for more information.
  • Raster data is stored as SDO_GEORASTER objects in a database table.
  • Raster tile services are supported only if Oracle Java is enabled on your Oracle Autonomous AI Database Serverless deployments. To enable Oracle Java, see Enable Oracle Java for more information.