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

Can't display pg_tileserv and postgis tiles #203

Open
ignarl opened this issue Apr 3, 2024 · 1 comment
Open

Can't display pg_tileserv and postgis tiles #203

ignarl opened this issue Apr 3, 2024 · 1 comment

Comments

@ignarl
Copy link

ignarl commented Apr 3, 2024

Hi! I'm trying to display custom tiles served by a local pg_tileserv and postgis db.

On my browser I can see correctly the preview of my map tiles:
http://localhost:7800/public.get_mvt_ocho.html#13.67/-34.86908/-56.22318

image

This is my flutter code, where the basemap from openstreet maps is correctly being displayed.

          return Column(
            children: [
              Expanded(
                child: FlutterMap(
                  mapController: state.mapController,
                  options: MapOptions(
                    initialCenter:
                        style.center ?? const LatLng(49.246292, -123.116226),
                    initialZoom: style.zoom ?? 10,
                  ),
                  children: [
                    TileLayer(
                      urlTemplate:
                          "http://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
                    ),
                    vp.VectorTileLayer(
                        layerMode: vp.VectorTileLayerMode.vector,
                        tileProviders: style.providers,
                        theme: style.theme)
                  ],
                ),
              ),
            ],
          );

This is my provider:

          final style = vp.Style(
            theme: ss.ThemeReader().read(qStyle()),
            center: const LatLng(
              -33.15488634877726,
              -60.447959645902344,
            ),
            providers: vp.TileProviders(
              {
                'qtiles': vp.NetworkVectorTileProvider(
                  urlTemplate:
                      'http://localhost:7800/public.get_mvt_ocho/{z}/{x}/{y}.pbf',
                  maximumZoom: 14,
                )
              },
            ),
            zoom: 14,
          );

and this is my current style:

dynamic qStyle() => {
      "version": 8,
      "name": "q style",
      "sources": {
        "qtiles": {
          "url": "http://localhost:7800/public.get_mvt_ocho/{z}/{x}/{y}.pbf",
          "type": "vector"
        }
      },
      "layers": [
        {
          "id": "batis",
          "type": "fill",
          "source": "qvtiles",
          "source-layer": "public.get_mvt_diez",
          "paint": {"fill-color": "rgb(12,12,12)"}
        }
      ]
    };

Can you help me debug the issue?

Thank you!

@ignarl
Copy link
Author

ignarl commented Apr 6, 2024

I got it working with this style:

  {
    "id": "get_mvt_batis",
    "type": "line",
    "source": "qtiles",
    "source-layer": "batis",
    "paint": {"line-color": "#00138C", "line-width": 1}
  },

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

No branches or pull requests

1 participant