martin icon indicating copy to clipboard operation
martin copied to clipboard

Serving multi-layer tiles from PostGIS

Open superrache opened this issue 4 months ago • 0 comments

Declaring multiple PostGIS layer tables in the configuration file makes Martin to serve multiple tiles (one tile service by layer). It would be useful to be able to declare all the layers in a same tile service.

Actual config file:

...
postgres:
  ...
  auto_published: false
  tables:
    buildings:
      layer_id: buildings
      schema: public
      table: buildings
      srid: 3857
      geometry_column: geom
      id_column: ~
      minzoom: 14
      maxzoom: 14
      bounds: [ -180.0, -90.0, 180.0, 90.0 ]
      extent: 4096
      buffer: 64
      clip_geom: true
      geometry_type: POLYGON
      properties:
        area_id: int4
    boundaries:
      layer_id: boundaries
      schema: public
      table: boundaries
      srid: 3857
      geometry_column: geom
      id_column: ~
      minzoom: 2
      maxzoom: 14
      bounds: [ -180.0, -90.0, 180.0, 90.0 ]
      extent: 4096
      buffer: 64
      clip_geom: true
      geometry_type: LINESTRING
      properties:
        way_id: int4
        admin_level: integer
        maritime: string
        disputed: string

What is generated in the /catalog:

{
    "tiles": {
        "boundaries": {
            "content_type": "application/x-protobuf",
            "description": "public.boundaries.geom"
        },
        "buildings": {
            "content_type": "application/x-protobuf",
            "description": "public.buildings.geom"
        }
    }
}

And in the boundaries TileJSON, only one vector_layers:

{
    "tilejson": "3.0.0",
    "tiles": [
        "http://localhost:3000/boundaries/{z}/{x}/{y}"
    ],
    "vector_layers": [
        {
            "id": "boundaries",
            "fields": {
                "admin_level": "integer",
                "disputed": "string",
                "maritime": "string",
                "way_id": "int4"
            }
        }
    ],
    "bounds": [-180, -90, 180, 90],
    "description": "public.boundaries.geom",
    "maxzoom": 14,
    "minzoom": 2,
    "name": "boundaries"
}

It would be useful to declare a MVT service "all" containing both "boundaries" and "buildings" in vector_layers.

Maybe it's possible but didn't find how to do that in the documentation.

superrache avatar Oct 09 '24 15:10 superrache