[{"data":1,"prerenderedAt":368},["ShallowReactive",2],{"page-\u002Fguides\u002Fstyle-autogen":3},{"id":4,"title":5,"body":6,"description":360,"extension":361,"meta":362,"navigation":363,"path":364,"seo":365,"stem":366,"__hash__":367},"content\u002F4.guides\u002F21.style-autogen.md","Style Auto-Generation",{"type":7,"value":8,"toc":354},"minimark",[9,35,40,110,114,125,155,166,185,195,199,252,275,279,285,350],[10,11,12,13,17,18,21,22,25,26,29,30,34],"p",{},"Every vector source can be previewed instantly — even if you never authored a\n",[14,15,16],"code",{},"style.json"," for it. When you request ",[14,19,20],{},"GET \u002Fstyles\u002F{id}\u002Fstyle.json"," and no\n",[14,23,24],{},"[[styles]]"," entry matches ",[14,27,28],{},"{id}",", but a ",[31,32,33],"strong",{},"vector source"," with that id exists,\ntileserver-rs generates a complete MapLibre GL v8 style on the fly.",[36,37,39],"h2",{"id":38},"when-it-triggers","When it triggers",[41,42,43,56],"table",{},[44,45,46],"thead",{},[47,48,49,53],"tr",{},[50,51,52],"th",{},"Condition",[50,54,55],{},"Result",[57,58,59,71,87,101],"tbody",{},[47,60,61,68],{},[62,63,64,65,67],"td",{},"A ",[14,66,24],{}," entry matches the id",[62,69,70],{},"The configured style is returned (auto-gen is never consulted)",[47,72,73,80],{},[62,74,75,76,79],{},"No style matches, but a ",[31,77,78],{},"vector"," source (PMTiles \u002F MBTiles \u002F MLT) shares the id",[62,81,82,83,86],{},"An auto-generated style is returned (",[14,84,85],{},"200",")",[47,88,89,96],{},[62,90,91,92,95],{},"No style matches and the source is ",[31,93,94],{},"raster"," (COG, DEM, PNG)",[62,97,98],{},[14,99,100],{},"404 Style not found",[47,102,103,106],{},[62,104,105],{},"Nothing matches the id at all",[62,107,108],{},[14,109,100],{},[36,111,113],{"id":112},"what-the-generated-style-looks-like","What the generated style looks like",[10,115,116,117,120,121,124],{},"For each entry in the source's TileJSON ",[14,118,119],{},"vector_layers",", three paint layers are\nemitted so that ",[31,122,123],{},"any"," geometry renders regardless of what the layer contains:",[126,127,128,139,147],"ul",{},[129,130,131,132,135,136],"li",{},"a ",[14,133,134],{},"fill"," layer filtered to ",[14,137,138],{},"[\"==\", \"$type\", \"Polygon\"]",[129,140,131,141,135,144],{},[14,142,143],{},"line",[14,145,146],{},"[\"==\", \"$type\", \"LineString\"]",[129,148,131,149,135,152],{},[14,150,151],{},"circle",[14,153,154],{},"[\"==\", \"$type\", \"Point\"]",[10,156,157,158,161,162,165],{},"The ",[14,159,160],{},"$type"," filter collapses ",[14,163,164],{},"Multi*"," geometries to their singular form, so the\nthree filters together cover every feature.",[10,167,168,169,172,173,176,177,180,181,184],{},"Layers are grouped ",[31,170,171],{},"all fills → all lines → all circles"," across source-layers\nso polygons never paint over points. Each source-layer gets a deterministic\ncolor (a stable hue derived from a hash of the layer id), with ",[14,174,175],{},"fill-outline-color","\nalways set and zoom-interpolated ",[14,178,179],{},"line-width"," \u002F ",[14,182,183],{},"circle-radius",".",[10,186,187,188,190,191,194],{},"Empty or missing ",[14,189,119],{}," still yields a valid style with a single\n",[14,192,193],{},"background"," layer — the viewer renders a blank map rather than erroring.",[36,196,198],{"id":197},"example","Example",[200,201,206],"pre",{"className":202,"code":203,"language":204,"meta":205,"style":205},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","curl -s http:\u002F\u002Flocalhost:8080\u002Fstyles\u002Fprotomaps\u002Fstyle.json | jq '.version, (.layers | length)'\n# 8\n# 10   (background + 3 kinds × 3 source-layers)\n","bash","",[14,207,208,239,246],{"__ignoreMap":205},[209,210,212,216,220,223,227,230,233,236],"span",{"class":143,"line":211},1,[209,213,215],{"class":214},"sBMFI","curl",[209,217,219],{"class":218},"sfazB"," -s",[209,221,222],{"class":218}," http:\u002F\u002Flocalhost:8080\u002Fstyles\u002Fprotomaps\u002Fstyle.json",[209,224,226],{"class":225},"sMK4o"," |",[209,228,229],{"class":214}," jq",[209,231,232],{"class":225}," '",[209,234,235],{"class":218},".version, (.layers | length)",[209,237,238],{"class":225},"'\n",[209,240,242],{"class":143,"line":241},2,[209,243,245],{"class":244},"sHwdD","# 8\n",[209,247,249],{"class":143,"line":248},3,[209,250,251],{"class":244},"# 10   (background + 3 kinds × 3 source-layers)\n",[10,253,254,255,258,259,262,263,266,267,270,271,274],{},"The generated style points its source at the TileJSON endpoint\n(",[14,256,257],{},"\u002Fdata\u002F{id}.json","). Any ",[14,260,261],{},"?key="," query is forwarded to that URL and to the\n",[14,264,265],{},"glyphs"," URL. MLT sources emit inline ",[14,268,269],{},".pbf"," tiles because ",[14,272,273],{},"maplibre-gl-js","\ncannot decode MLT directly.",[36,276,278],{"id":277},"providing-your-own-style","Providing your own style",[10,280,281,282,284],{},"To fully control the appearance, add a ",[14,283,24],{}," entry — it always takes\nprecedence over auto-generation:",[200,286,290],{"className":287,"code":288,"language":289,"meta":205,"style":205},"language-toml shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","[[styles]]\nid = \"protomaps\"\npath = \"\u002Fdata\u002Fstyles\u002Fprotomaps\u002Fstyle.json\"\nname = \"Protomaps\"\n","toml",[14,291,292,303,321,335],{"__ignoreMap":205},[209,293,294,297,300],{"class":143,"line":211},[209,295,296],{"class":225},"[[",[209,298,299],{"class":214},"styles",[209,301,302],{"class":225},"]]\n",[209,304,305,309,312,315,318],{"class":143,"line":241},[209,306,308],{"class":307},"sTEyZ","id ",[209,310,311],{"class":225},"=",[209,313,314],{"class":225}," \"",[209,316,317],{"class":218},"protomaps",[209,319,320],{"class":225},"\"\n",[209,322,323,326,328,330,333],{"class":143,"line":248},[209,324,325],{"class":307},"path ",[209,327,311],{"class":225},[209,329,314],{"class":225},[209,331,332],{"class":218},"\u002Fdata\u002Fstyles\u002Fprotomaps\u002Fstyle.json",[209,334,320],{"class":225},[209,336,338,341,343,345,348],{"class":143,"line":337},4,[209,339,340],{"class":307},"name ",[209,342,311],{"class":225},[209,344,314],{"class":225},[209,346,347],{"class":218},"Protomaps",[209,349,320],{"class":225},[351,352,353],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}",{"title":205,"searchDepth":241,"depth":241,"links":355},[356,357,358,359],{"id":38,"depth":241,"text":39},{"id":112,"depth":241,"text":113},{"id":197,"depth":241,"text":198},{"id":277,"depth":241,"text":278},"Auto-generated MapLibre styles for vector sources without a configured style","md",{},true,"\u002Fguides\u002Fstyle-autogen",{"title":5,"description":360},"4.guides\u002F21.style-autogen","hJKoyjUmhk7uX8x-MoOo0tqGV0RHCbJ6bCJ7-gjT98Q",1794150614037]