Source

Trait Source 

Source
pub trait Source: Send + Debug {
    // Required methods
    fn get_id(&self) -> &str;
    fn get_tilejson(&self) -> &TileJSON;
    fn get_tile_info(&self) -> TileInfo;
    fn clone_source(&self) -> BoxedSource;
    fn get_tile<'life0, 'life1, 'async_trait>(
        &'life0 self,
        xyz: TileCoord,
        url_query: Option<&'life1 UrlQuery>,
    ) -> Pin<Box<dyn Future<Output = MartinCoreResult<TileData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get_version(&self) -> Option<String> { ... }
    fn support_url_query(&self) -> bool { ... }
    fn benefits_from_concurrent_scraping(&self) -> bool { ... }
    fn is_valid_zoom(&self, zoom: u8) -> bool { ... }
    fn get_catalog_entry(&self) -> CatalogSourceEntry { ... }
}
Expand description

Core trait for tile sources providing data to Martin

Implementors can serve tiles from databases, files, or other backends.

Required Methods§

Source

fn get_id(&self) -> &str

Unique source identifier used in URLs.

Source

fn get_tilejson(&self) -> &TileJSON

TileJSON specification served to clients.

Source

fn get_tile_info(&self) -> TileInfo

Technical tile information (format, encoding, etc.).

Source

fn clone_source(&self) -> BoxedSource

Creates a boxed clone for trait object storage.

Source

fn get_tile<'life0, 'life1, 'async_trait>( &'life0 self, xyz: TileCoord, url_query: Option<&'life1 UrlQuery>, ) -> Pin<Box<dyn Future<Output = MartinCoreResult<TileData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves tile data for the given coordinates.

§Arguments
  • xyz - Tile coordinates (x, y, zoom)
  • url_query - Optional query parameters for dynamic tiles

Provided Methods§

Source

fn get_version(&self) -> Option<String>

A version string for this source, if available. Default: None. If available, this string is appended to tile URLs as a query parameter, invalidating caches.

Source

fn support_url_query(&self) -> bool

Whether this source accepts URL query parameters. Default: false.

Source

fn benefits_from_concurrent_scraping(&self) -> bool

Whether martin-cp should use concurrent scraping. Default: false.

Source

fn is_valid_zoom(&self, zoom: u8) -> bool

Validates zoom level against TileJSON min/max zoom constraints.

Source

fn get_catalog_entry(&self) -> CatalogSourceEntry

Generates catalog entry for this source.

Implementors§