-1

Using "@mapbox/mapbox-sdk": "^0.13.2" to create a style.

I want to add a WMS source to my style as this example shows https://docs.mapbox.com/mapbox-gl-js/example/wms/

This works fine in the browser but when I try and add

'wms-test-source', { 'type': 'raster', 'tiles': ['url_to_WMS_source'], 'tileSize': 256 }

Using the Mapbox SDK https://github.com/mapbox/mapbox-sdk-js/blob/main/docs/services.md#createstyle

I get this error "message": "source.tiles: Unsupported property \"tiles\""

According to their docs this is possible https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/

If anyone has any suggestions they would be greatly appreciated

paul blackmore
  • 191
  • 2
  • 13

1 Answers1

0

Mapbox hosted Styles will only work with Mapbox hosted tileset sources. GL JS does support loading additional kinds of sources, as in the WMS example.

  • Thanks for your answer. Can you point to some documentation on this? I can not find any restrictions here https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/ – paul blackmore Apr 27 '22 at 08:07
  • The full style spec, implemented in GL and the mobile SDKs, does work in client side integrations with other kinds of sources. The Style API for Mapbox hosted styles only works with raster and vector sources. https://docs.mapbox.com/api/maps/styles/#the-style-object specifies this. – Mikel Maron May 04 '22 at 14:12