hhkaos / flutter_arcgis_basemaps

Example project loading ArcGIS vector basemaps using Fluttler
3 stars 0 forks source link

Labels are not been displayed #1

Open hhkaos opened 1 year ago

hhkaos commented 1 year ago

I'm not sure why but labels are not been displayed on any map style:

hhkaos commented 1 year ago

Here some hints to help us fix this

Note: in addition to that repo, another place to look for help could be the GMaps Discord channel

lukaszszyman commented 1 year ago

Hello @hhkaos. Thanks for a nice start-up project that helped me to investigate vector maps in flutter. I spent some time on it and discovered a possible solution for your issue. Please try to use this in your example:

          VectorTileLayer(
            theme: _mapTheme(style, {
              ThemeLayerType.symbol,
              ThemeLayerType.background,
              ThemeLayerType.fill
            }),
            backgroundTheme: ProvidedThemes.lightTheme()
                .copyWith(types: {ThemeLayerType.fill}),

It helped me to display labels.

vector_map

In a comment below I pasted the code allowing to display World Imagery as a background. Good luck.

lukaszszyman commented 1 year ago

If you would like to have World Imagery as a background (raster TileLayer) and vector streets, borders on a map (ThemeLayerType.line), you can use

          TileLayer(
            urlTemplate: _rasterTileUrlTemplate('World_Imagery'),
            tileProvider: CachedNetworkTileProvider(), // can be NetworkTileProvider()
            minZoom: 1,
            maxZoom: 17,
          ),
          VectorTileLayer(
            theme: _mapTheme(style, {
              ThemeLayerType.line, // country, city, district, street lines
              ThemeLayerType.symbol, // country, city, street labels
            }),
            tileProviders: TileProviders(
              {
                'esri': _cachingTileProvider(
                  _vectorTileUrlTemplate('World_Basemap_v2'),
                )
              },
            ),
          ),

            String _vectorTileUrlTemplate(String type) =>
  'https://basemaps-api.arcgis.com/arcgis/rest/services/$type/VectorTileServer/tile/{z}/{y}/{x}.pbf?token=$apiKey';

          String _rasterTileUrlTemplate(String type) =>
  'https://services.arcgisonline.com/ArcGIS/rest/services/$type/MapServer/tile/{z}/{y}/{x}?token=$apiKey';

Additionally, download and use styles from "arcgis-imagery": "ArcGIS:Imagery". They are much better when used with World Imagery.

Results:

vector_map2 vector_map3

In case your map can't be updated (previously downloaded map will be displayed, without labels), please ensure that you removed cache from your device and re-download tiles.

hhkaos commented 1 year ago

Thank you very much @lukaszszyman !! I had a crazy week and I didn't have time to check, but I will try soon! thanks 🙏