Using JSON style with map

134 views
Skip to first unread message

johnswain

unread,
Aug 23, 2018, 5:14:28 PM8/23/18
to MapTiler Community
I am planning to use MapTiler Cloud to get vector map data. It currently loads the map using the following line: 
mapStyle = "https://maps.tilehosting.com/styles/basic/style.json?key=..."
However, I already have my own custom map style for the vector tiles as a JSON file.
Is it possible to get the vector map tiles from MapTiler and set the json style locally? I have tried uploading the custom style to your MapTiler as an alternative method but I am getting an error to say that it is too large. (270kb)

Petr Pridal

unread,
Aug 24, 2018, 11:28:41 AM8/24/18
to MapTiler Community
Yes, it is possible to host the style locally as well as upload the style to Cloud....

270Kb for a style is a huge! You must be doing something very strange in the style...

Could you please post he style for review? We could then help you to identify the problem...

Local hosting example if visible for example at https://openmaptiles.github.io/klokantech-basic-gl-style/ (use View Source... in your browser).

The link to style can be just filename - in such case it is looked for in local directory on your own webserver.

Petr

johnswain

unread,
Aug 26, 2018, 5:22:06 AM8/26/18
to MapTiler Community
I am using custom svg images in my style including background textures so that it why it is larger.

Just had a look at the example.
      var map = new mapboxgl.Map({
        container
: 'map',
        style
: 'style-cdn.json',
        attributionControl
: true,
        hash
: true
     
});
      map
.addControl(new mapboxgl.NavigationControl());

  
If style: 'style-cdn.json' is the local path to my map style, where do I put the link to https://maps.tilehosting.com or https://cloud.maptiler.com/ to fetch the actual vector map data?
Reply all
Reply to author
Forward
0 new messages