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

Serving multi-layer tiles from PostGIS #1538

Open
superrache opened this issue Oct 9, 2024 · 2 comments
Open

Serving multi-layer tiles from PostGIS #1538

superrache opened this issue Oct 9, 2024 · 2 comments

Comments

@superrache
Copy link

superrache commented Oct 9, 2024

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.

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Oct 23, 2024

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

Adding a special ID all to mean all layer_id's would be breaking for users that expect that ID to behave differntly in a somewhat sublte way.
=> adding that ID alias is likely not a good idea.

I think your usage is to have composite sources boundaries,buildings instead which serves them both.
relevant docs: https://maplibre.org/martin/sources-composite.html

Does this solve your issue?

@CommanderStorm
Copy link
Collaborator

Can the docs be improved?
Where did you look to find this? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants