1

I have a map application with custom interactive layers, but I want to use the dark theme from this. I'm using playing around on jsfiddle and I just can't seen to get the dark theme to work. I tried this:

      new TileLayer({
        source: new TileJSON({
          url: 'https://raw.githubusercontent.com/openmaptiles/dark-matter-gl-style/master/style.json'
        })
      })

I'm using classic apache and php. I have no clue about npm and webpack.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
lee
  • 740
  • 2
  • 11
  • 24

2 Answers2

4

We are the authors of OpenMapTiles project and the repos you are linking.

If you need to use the dark-matter-gl style - the easiest is to go to https://cloud.maptiler.com/maps/darkmatter/, create a free account and copy&paste the sample viewer provided on this website.

This gives you free hosting and the style into your webpage - with a viewer of your choice, including OpenLayers.

MapTiler
  • 1,754
  • 14
  • 22
3

The style.json is only a Mapbox Style Specification, not the Data as TileJSON itself.

You can use Mapbox Style Specifications for Vector Tile Layers like the OSM by using ol-mapbox-style. There is also some information about this issue on openmaptiles, where you found the theme.

Rob
  • 651
  • 3
  • 14
  • I have no clue how to use `ol-mapbox-style`. They seem to assume you're using `npm` and `webpack`, I don't use either. I'm using classic apache and php. – lee Sep 26 '19 at 17:02
  • Thx for sharing the fiddle! unpkg.com is a great tool for using modern software in classic environments – Rob Sep 27 '19 at 12:53