This commit is contained in:
Zsolt Ero
2024-01-11 20:08:56 +01:00
parent e37fc36ede
commit 0af48cfac1
8 changed files with 400 additions and 279 deletions

View File

@@ -25,6 +25,27 @@ select {
font: inherit; font: inherit;
} }
/* normalize.css */
button {
font-family: inherit;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
text-transform: none;
-webkit-appearance: button;
}
button::-moz-focus-inner {
border-style: none;
padding: 0;
}
button:-moz-focusring {
outline: 1px dotted ButtonText;
}
/* --- start --- */ /* --- start --- */
body { body {
@@ -45,7 +66,8 @@ h2,
h3, h3,
h4, h4,
h5, h5,
h6 { h6,
.col-lbl {
color: #555; color: #555;
max-width: 600px; max-width: 600px;
margin: 1em auto 0.5em; margin: 1em auto 0.5em;
@@ -58,6 +80,14 @@ h6 {
a { a {
color: #444; color: #444;
font-weight: 700;
text-decoration: none;
box-shadow: 0 1px 0 #007cd7;
transition: box-shadow 200ms ease 0s;
}
a:hover {
box-shadow: 0 2px 0 #007cd7;
} }
.logo { .logo {
@@ -78,7 +108,7 @@ pre {
background: #efefef; background: #efefef;
max-width: 800px; max-width: 800px;
margin: 0 auto 0.6em; margin: 0 auto 0.6em !important;
font-size: 14px; font-size: 14px;
} }
@@ -93,3 +123,47 @@ code {
height: 500px; height: 500px;
margin-bottom: 2em; margin-bottom: 2em;
} }
button {
border: 0;
border-radius: 0.25rem;
background: #007cd7;
color: white;
font-family: -system-ui, sans-serif;
font-size: 1rem;
line-height: 1.2;
white-space: nowrap;
text-decoration: none;
padding: 0.25rem 0.5rem;
margin: 0.25rem;
cursor: pointer;
}
/*button:hover { }*/
/*button:focus { }*/
/*button:active { }*/
.col-lbl {
display: block;
}
.col-chk {
display: none;
}
.col-lbl:before {
content: '►';
margin-right: 1em;
}
.col-cnt {
display: none;
}
.col-chk:checked ~ .col-cnt {
display: block;
}
.col-chk:checked ~ .col-lbl:before {
content: '▼';
}

View File

@@ -14,6 +14,9 @@ def generate():
template = open('template.html').read() template = open('template.html').read()
template = template.replace('{text}', text_html) template = template.replace('{text}', text_html)
style_selector = open('map_docs.html').read()
template = template.replace('<!--map_docs-->', style_selector)
open('index.html', 'w').write(template) open('index.html', 'w').write(template)

View File

@@ -25,235 +25,197 @@
<h1>OpenFreeMap</h1> <h1>OpenFreeMap</h1>
<h2>What is this?</h2> <h2>What is this?</h2>
<p>OpenFreeMap is an open and free OpenStreetMap tile hosting service.</p> <p>OpenFreeMap is an open and free OpenStreetMap tile hosting service.</p>
<p> <p>It's truly free: there is no limit on the amount of map views or requests you can make or how you use your map. There is no registration page, user database, API keys nor cookies.</p>
It's truly free: there is no limit on the amount of map views or requests you can make or how
you use your map. There is no registration page, user database, API keys nor cookies.
</p>
<p>It's truly open source: everything, including the full production setup is on GitHub.</p> <p>It's truly open source: everything, including the full production setup is on GitHub.</p>
<h2>Why is this important?</h2> <h2>Why is this important?</h2>
<p> <p>OpenStreetMap is one of the most important collective projects in history. More than 2 million users have contributed to it over 19 years; 3 million edits are made each day.</p>
OpenStreetMap is one of the most important collective projects in history. More than 2 million <p>Unfortunately, when you want to use the map on your website or app, you need to look for a commercial map tile provider and hope your site doesn't get too popular, otherwise you might end up with a $10,000 bill in a single day, like Hoodmaps did <a href="https://twitter.com/levelsio/status/1730659933232730443">*</a>.</p>
users have contributed to it over 19 years; 3 million edits are made each day.
</p>
<p>
Unfortunately, when you want to use the map on your website or app, you need to look for a
commercial map tile provider and hope your site doesn't get too popular, otherwise you might
end up with a $10,000 bill in a single day, like Hoodmaps did
<a href="https://twitter.com/levelsio/status/1730659933232730443">*</a>.
</p>
<p>You can try self-hosting, but it requires a big server and a lot of time to get it right.</p> <p>You can try self-hosting, but it requires a big server and a lot of time to get it right.</p>
<h2>Who is behind this project?</h2> <h2>Who is behind this project?</h2>
<p> <p>I'm Zsolt Ero (<a href="https://twitter.com/hyperknot">twitter</a>, <a href="https://blog.hyperknot.com/">blog</a>). I've created <a href="https://maphub.net/">MapHub</a> and I've been running map hosting in production for 8 years.</p>
I'm Zsolt Ero (<a href="https://twitter.com/hyperknot">twitter</a>,
<a href="https://blog.hyperknot.com/">blog</a>). I've created
<a href="https://maphub.net/">MapHub</a> and I've been running map hosting in production for 8
years.
</p>
<h2>How can I use it?</h2> <h2>How can I use it?</h2>
<div id="map"></div> <div id="map"></div>
<!--style_selector-->
<p> <p>
Include <a href="https://maplibre.org/maplibre-gl-js/docs/">MapLibre GL JS</a> in Choose style:
<code>&lt;head&gt;</code> <button onclick="selectStyle('bright')">Bright</button>
<button onclick="selectStyle('liberty')">Liberty</button>
<button onclick="selectStyle('positron')">Positron</button>
</p> </p>
<pre><code>&lt;script src=&quot;https://unpkg.com/maplibre-gl/dist/maplibre-gl.js&quot;&gt;&lt;/script&gt; <p>
Use the following style in a MapLibre map:
<code id="style-url-code">https://tiles.openfreemap.org/styles/liberty</code>
</p>
<input type="checkbox" id="col1" class="col-chk" />
<label for="col1" class="col-lbl">How to load MapLibre?</label>
<div class="col-cnt">
<p>
Include
<a href="https://maplibre.org/maplibre-gl-js/docs/" target="_blank">MapLibre GL JS</a> in the
<code>&lt;head&gt;</code>. If you are using npm, you can install the
<code>maplibre-gl</code> package, but make sure to load the CSS manually.
</p>
<pre><code class="language-html">&lt;script src=&quot;https://unpkg.com/maplibre-gl/dist/maplibre-gl.js&quot;&gt;&lt;/script&gt;
&lt;link &lt;link
href=&quot;https://unpkg.com/maplibre-gl/dist/maplibre-gl.css&quot; href=&quot;https://unpkg.com/maplibre-gl/dist/maplibre-gl.css&quot;
rel=&quot;stylesheet&quot; rel=&quot;stylesheet&quot;
/&gt; /&gt;
</code></pre> </code></pre>
<p>And initialize it to a div, like this:</p> <p>And initialize it to a div, like this:</p>
<pre><code>&lt;div id=&quot;map&quot; style=&quot;width: 100%; height: 500px&quot;&gt;&lt;/div&gt; <pre><code class="language-html">&lt;div id=&quot;map&quot; style=&quot;width: 100%; height: 500px&quot;&gt;&lt;/div&gt;
&lt;script&gt; &lt;script&gt;
const map = new maplibregl.Map({ const map = new maplibregl.Map({
style: &#x27;https://tiles.openfreemap.org/styles/liberty&#x27;, style: 'https://tiles.openfreemap.org/styles/liberty',
center: [-0.114, 51.506], center: [-0.114, 51.506],
zoom: 14.2, zoom: 14.2,
container: &#x27;map&#x27; container: 'map';
}) })
&lt;/script&gt; &lt;/script&gt;
</code></pre> </code></pre>
</div>
<div>
<input type="checkbox" id="col2" class="col-chk" />
<label for="col2" class="col-lbl">Using Mapbox?</label>
<div class="col-cnt">
<p> <p>
If you've used Mapbox GL before, please migrate to MapLibre. It is based on the last If you are currently using Mapbox, please change your libraries to
open-source version of Mapbox GL, before it went closed-source. A Leaflet based snippet is <a href="https://maplibre.org/maplibre-gl-js/docs/" target="_blank">MapLibre GL JS</a>.
coming soon. MapLibre is based on the last open-source version of Mapbox GL JS, before it went
closed-source. Migrating should be as simple as changing the libraries, as long as you are not
using any features specific to the 2.x or later release.
</p>
</div>
</div>
<div>
<input type="checkbox" id="col3" class="col-chk" />
<label for="col3" class="col-lbl">Using Leaflet?</label>
<div class="col-cnt">
<p>A Leaflet based snippet is coming soon.</p>
</div>
</div>
<div>
<input type="checkbox" id="col4" class="col-chk" />
<label for="col4" class="col-lbl">Mobile apps</label>
<div class="col-cnt">
<p>
For mobile apps, you can use the same style with
<a href="https://maplibre.org/" target="_blank">MapLibre Native</a>.
</p>
</div>
</div>
<div>
<input type="checkbox" id="col6" class="col-chk" />
<label for="col6" class="col-lbl">Custom styles</label>
<div class="col-cnt">
<p>
You can customise the styles using the
<a href="https://maputnik.github.io/" target="_blank">Maputnik</a> editor. For example you can
remove labels, POIs or change colors.
</p> </p>
<p> <p>
For mobile apps, you can do the same with <a href="https://maplibre.org/">MapLibre Native.</a> When you use a customised style, you need to host the style JSON youself, and use this URL in
MapLibre.
</p> </p>
<p>
<a
href="https://maputnik.github.io/editor?style=https://tiles.openfreemap.org/styles/bright"
target="_blank"
>Customise Bright</a
>
</p>
<p>
<a
href="https://maputnik.github.io/editor?style=https://tiles.openfreemap.org/styles/liberty"
target="_blank"
>Customise Liberty</a
>
</p>
<p>
<a
href="https://maputnik.github.io/editor?style=https://tiles.openfreemap.org/styles/positron"
target="_blank"
>Customise Positron</a
>
</p>
</div>
<div>
<input type="checkbox" id="col5" class="col-chk" />
<label for="col5" class="col-lbl">Self-hosting</label>
<div class="col-cnt">
<p> <p>
You can also download our processed planet MBTiles and BTRFS images if you want to self-host You can also download our processed planet MBTiles and BTRFS images if you want to self-host
yourself. Details are in the GitHub at yourself. Details are in
<a href="https://github.com/hyperknot/openfreemap">hyperknot/openfreemap</a>. <a href="https://github.com/hyperknot/openfreemap" target="_blank">GitHub</a>.
</p> </p>
</div>
</div>
</div>
<h2>How can I donate or support this project?</h2> <h2>How can I donate or support this project?</h2>
<p>...</p> <p>...</p>
<h2>How can I follow this project?</h2> <h2>How can I follow this project?</h2>
<p> <p>twitter: <a href="https://twitter.com/hyperknot">hyperknot</a> and <a href="https://twitter.com/OpenFreeMapOrg">OpenFreeMapOrg</a></p>
The main repo is <a href="https://github.com/hyperknot/openfreemap">hyperknot/openfreemap</a> <p>The main repo is <a href="https://github.com/hyperknot/openfreemap">hyperknot/openfreemap</a></p>
</p> <p>Styles are at <a href="https://github.com/hyperknot/openfreemap-styles">hyperknot/openfreemap-styles</a></p>
<p>
Styles are at
<a href="https://github.com/hyperknot/openfreemap-styles">hyperknot/openfreemap-styles</a>
</p>
<p>twitter: <a href="https://twitter.com/hyperknot">@hyperknot</a></p>
<p>twitter: <a href="https://twitter.com/OpenFreeMapOrg">@OpenFreeMapOrg</a></p>
<p>mastodon zsolt https://elk.zone/sigmoid.social/@hyperknot/followers</p> <p>mastodon zsolt https://elk.zone/sigmoid.social/@hyperknot/followers</p>
<p>mastodon ofm TODO</p> <p>mastodon ofm TODO</p>
<h2>Is commercial usage allowed?</h2> <h2>Is commercial usage allowed?</h2>
<p>Yes.</p> <p>Yes</p>
<h2>Why did I make this?</h2> <h2>Why did you make this?</h2>
<p> <p>Because I waited for years for someone to offer this service, but realised no one is going to make it. So, I thought I might use my map hosting experience and do it.</p>
Because I waited for years for someone to offer this service, but realised no one is going to <p>I'll share more about the why in a <a href="https://blog.hyperknot.com/">blog post</a> in the future, feel free to subscribe.</p>
make it. So, I thought I might use my map hosting experience and do it.
</p>
<p>
I'll share more about the why in a blog post in the future, feel free to subscribe on the
links above.
</p>
<h2>How can this work? How can a one person project offer unlimited map hosting for free?</h2> <h2>How can this work? How can a one person project offer unlimited map hosting for free?</h2>
<p> <p>There is no technical reason why vector tile hosting should cost as much as it does today.</p>
There is no technical reason why vector tile hosting should cost as much as it does today. <p>Vector tiles are just static files. OK, serving 300 million files is not easy, but at the end of the day they are just files.</p>
</p> <p>Financially, the plan is to keep renting Hetzner servers until they cover the bandwidth. I believe it can work if enough people subscribe to the support plans.</p>
<p> <p>If this project helps you to save a lot on your map hosting costs, please consider subscribing to a support plan!</p>
Vector tiles are just static files. OK, serving 300 million files is not easy, but at the end
of the day they are just files.
</p>
<p>
Financially, the plan is to keep buying Hetzner servers until they cover the bandwidth. I
believe it can work if enough people contribute. If this project helps you save your map
hosting costs, please consider our support plans!
</p>
<h2>What is the tech stack?</h2> <h2>What is the tech stack?</h2>
<p> <p>The map schema is <a href="https://github.com/openmaptiles/openmaptiles">OpenMapTiles</a>.</p>
The map schema is <a href="https://github.com/openmaptiles/openmaptiles">OpenMapTiles</a>. <p>The tiles are generated by <a href="https://github.com/onthegomap/planetiler">Planetiler</a>.</p>
</p> <p>There is no tile server running, only BTRFS partition images with 300 million hard linked files.</p>
<p>
The tiles are generated by <a href="https://github.com/onthegomap/planetiler">Planetiler</a>.
</p>
<p>
There is no tile server running, only BTRFS partition images with 300 million hard linked
files.
</p>
<p>The server is nginx on Ubuntu.</p> <p>The server is nginx on Ubuntu.</p>
<p>There is no cloud, just dedicated servers on Hetzner.</p> <p>There is no cloud, just dedicated servers on Hetzner.</p>
<p>Currently using Cloudflare, but it's designed so that it can be changed any time.</p> <p>Currently using Cloudflare, but it's designed it so it can be changed any time.</p>
<p> <p>Moreover, a lot of work is going into customising the styles at <a href="https://github.com/hyperknot/openfreemap-styles">openfreemap-styles</a>.</p>
Moreover, a lot of work is going into customising the styles at
<a href="https://github.com/hyperknot/openfreemap-styles">openfreemap-styles</a>.
</p>
<h2>What about PMTiles?</h2> <h2>What about PMTiles?</h2>
<p>I would have loved to use PMTiles, they are a brilliant idea!</p> <p>I would have loved to use PMTiles, they are a brilliant idea!</p>
<p> <p>Unfortunately, making range requests in 80 GB files is just not working in production. They are fine for &lt; 500 MB files, but have terrible latency and caching issues for full planet datasets.</p>
Unfortunately, making range requests in 80 GB files is just not working in production. They
are fine for &lt; 500 MB files, but have terrible latency and caching issues for full planet
datasets.
</p>
<h2>Attribution</h2> <h2>Attribution</h2>
<p>If you are using MapLibre, attributions are automatically added.</p> <p>If you are using MapLibre, attributions are automatically added.</p>
<p>If you are using this in a printed media or video, please attribute:</p> <p>If you are using this in a printed media or video, please attribute:</p>
<p> <p><a href="https://openfreemap.org/" target="_blank">OpenFreeMap</a> <a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> Data from <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a></p>
<a href="https://openfreemap.org/" target="_blank">OpenFreeMap</a>
<a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> Data from
<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>
</p>
<p>You don't need to display the OpenFreeMap part, but it's nice if you do.</p> <p>You don't need to display the OpenFreeMap part, but it's nice if you do.</p>
<h2>Licenses</h2> <h2>Licenses</h2>
<p> <p>The license of this project is <a href="https://www.tldrlegal.com/license/mit-license">MIT</a>.</p>
The license of this project is
<a href="https://www.tldrlegal.com/license/mit-license">MIT</a>.
</p>
<p>Map data is from <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>.</p> <p>Map data is from <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>.</p>
<p> <p><a href="https://github.com/openmaptiles/openmaptiles">OpenMapTiles</a> code is released under the <a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a>, design under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>. <a href="https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md">LICENSE.md</a>.</p>
<a href="https://github.com/openmaptiles/openmaptiles">OpenMapTiles</a> code is released under
the
<a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a
>, design under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
<a href="https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md">LICENSE.md</a>.
</p>
<h3>Styles</h3> <h3>Styles</h3>
<h4>Bright</h4> <h4>Bright</h4>
<p> <p>Fork from <a href="https://github.com/openmaptiles/osm-bright-gl-style">openmaptiles/osm-bright-gl-style</a>. The OSM Bright GL Style is derived from <a href="https://github.com/mapbox/mapbox-gl-styles">Mapbox Open Styles</a>. The OSM Bright GL Styles code is released under the <a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a>. The OSM Bright GL Styles design is released under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>. <a href="https://github.com/openmaptiles/osm-bright-gl-style/blob/master/LICENSE.md">LICENSE.md</a>.</p>
Fork from
<a href="https://github.com/openmaptiles/osm-bright-gl-style"
>openmaptiles/osm-bright-gl-style</a
>. The OSM Bright GL Style is derived from
<a href="https://github.com/mapbox/mapbox-gl-styles">Mapbox Open Styles</a>. The OSM Bright GL
Styles code is released under the
<a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a
>. The OSM Bright GL Styles design is released under
<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
<a href="https://github.com/openmaptiles/osm-bright-gl-style/blob/master/LICENSE.md"
>LICENSE.md</a
>.
</p>
<h4>Liberty</h4> <h4>Liberty</h4>
<p> <p>Fork from <a href="https://github.com/maputnik/osm-liberty">maputnik/osm-liberty</a>. OSM Liberty is a fork of OSM Bright. The OSM Bright GL Style is derived from <a href="https://github.com/mapbox/mapbox-gl-styles">Mapbox Open Styles</a>. The OSM Bright GL Styles code is released under the <a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a>. The OSM Bright GL Styles design is released under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>. <a href="https://github.com/maputnik/osm-liberty/blob/gh-pages/LICENSE.md">LICENSE.md</a>.</p>
Fork from <a href="https://github.com/maputnik/osm-liberty">maputnik/osm-liberty</a>. OSM
Liberty is a fork of OSM Bright. The OSM Bright GL Style is derived from
<a href="https://github.com/mapbox/mapbox-gl-styles">Mapbox Open Styles</a>. The OSM Bright GL
Styles code is released under the
<a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a
>. The OSM Bright GL Styles design is released under
<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
<a href="https://github.com/maputnik/osm-liberty/blob/gh-pages/LICENSE.md">LICENSE.md</a>.
</p>
<h4>Positron</h4> <h4>Positron</h4>
<p> <p>Fork from <a href="https://github.com/openmaptiles/positron-gl-style">openmaptiles/positron-gl-style</a>. The Positron GL Style is derived from <a href="https://github.com/CartoDB/CartoDB-basemaps">CartoDB Basemaps</a> designed by Stamen and Paul Norman for CartoDB Inc., licensed under <a href="https://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>. The Positron GL styles code is released under the <a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a>. The Positron GL Styles design is released under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>. <a href="https://github.com/openmaptiles/positron-gl-style/blob/master/LICENSE.md">LICENSE.md</a>.</p>
Fork from
<a href="https://github.com/openmaptiles/positron-gl-style">openmaptiles/positron-gl-style</a
>. The Positron GL Style is derived from
<a href="https://github.com/CartoDB/CartoDB-basemaps">CartoDB Basemaps</a> designed by Stamen
and Paul Norman for CartoDB Inc., licensed under
<a href="https://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>. The Positron GL styles
code is released under the
<a href="https://tldrlegal.com/license/bsd-3-clause-license-(revised)">BSD 3-Clause License</a
>. The Positron GL Styles design is released under
<a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
<a href="https://github.com/openmaptiles/positron-gl-style/blob/master/LICENSE.md"
>LICENSE.md</a
>.
</p>
<h3>Fonts</h3> <h3>Fonts</h3>
<p> <p><a href="https://www.google.com/get/noto/">Noto Sans</a> is released under the <a href="https://openfontlicense.org/">SIL Open Font License, Version 1.1</a></p>
<a href="https://www.google.com/get/noto/">Noto Sans</a> is released under the
<a href="https://openfontlicense.org/">SIL Open Font License, Version 1.1</a>
</p>
<h3><strong>Icons</strong></h3> <h3><strong>Icons</strong></h3>
<p> <p>The <a href="https://github.com/mapbox/maki/blob/master/LICENSE.txt">Maki POI icon set</a> is licensed under CC0 1.0 Universal.</p>
The <a href="https://github.com/mapbox/maki/blob/master/LICENSE.txt">Maki POI icon set</a> is <p>The right arrow was derived from <a href="https://commons.wikimedia.org/wiki/File:Arrowright.svg">Wikipedia</a>, it is public domain.</p>
licensed under CC0 1.0 Universal.
</p>
<p>
The right arrow was derived from
<a href="https://commons.wikimedia.org/wiki/File:Arrowright.svg">Wikipedia</a>, it is public
domain.
</p>
<h3>Natural Earth</h3> <h3>Natural Earth</h3>
<p> <p><a href="https://www.naturalearthdata.com/">Natural Earth</a> map data is in the public domain.</p>
<a href="https://www.naturalearthdata.com/">Natural Earth</a> map data is in the public
domain.
</p>
<h3>Tools</h3> <h3>Tools</h3>
<p> <p>spritezero-cli is from <a href="https://github.com/mapbox/spritezero-cli">mapbox/spritezero-cli</a>, licensed <a href="https://github.com/mapbox/spritezero-cli/blob/master/LICENSE.md">ISC</a>.</p>
spritezero-cli is from
<a href="https://github.com/mapbox/spritezero-cli">mapbox/spritezero-cli</a>, licensed
<a href="https://github.com/mapbox/spritezero-cli/blob/master/LICENSE.md">ISC</a>.
</p>
<script src="map.js"></script> <script src="map.js"></script>
<script src="https://unpkg.com/prismjs@1.29.0/components/prism-core.min.js"></script> <script src="https://unpkg.com/prismjs@1.29.0/components/prism-core.min.js"></script>
<script src="https://unpkg.com/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script> <script src="https://unpkg.com/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var codeBlocks = document.querySelectorAll('pre')
codeBlocks.forEach(function (block) {
block.classList.add('language-js')
Prism.highlightElement(block)
})
})
</script>
</body> </body>
</html> </html>

View File

@@ -16,4 +16,13 @@ map.addControl(nav, 'top-right')
let scale = new maplibregl.ScaleControl() let scale = new maplibregl.ScaleControl()
map.addControl(scale) map.addControl(scale)
new maplibregl.Marker().setLngLat([-0.122, 51.503]).addTo(map) new maplibregl.Marker().setLngLat([-0.119, 51.507]).addTo(map)
function selectStyle(style) {
const styleUrl = 'https://tiles.openfreemap.org/styles/' + style
map.setStyle(styleUrl)
map.setPitch(0)
map.setBearing(0)
document.getElementById('style-url-code').innerText = styleUrl
}

122
website/map_docs.html Normal file
View File

@@ -0,0 +1,122 @@
<div id="map"></div>
<p>
Choose style:
<button onclick="selectStyle('bright')">Bright</button>
<button onclick="selectStyle('liberty')">Liberty</button>
<button onclick="selectStyle('positron')">Positron</button>
</p>
<p>
Use the following style in a MapLibre map:
<code id="style-url-code">https://tiles.openfreemap.org/styles/liberty</code>
</p>
<input type="checkbox" id="col1" class="col-chk" />
<label for="col1" class="col-lbl">How to load MapLibre?</label>
<div class="col-cnt">
<p>
Include
<a href="https://maplibre.org/maplibre-gl-js/docs/" target="_blank">MapLibre GL JS</a> in the
<code>&lt;head&gt;</code>. If you are using npm, you can install the
<code>maplibre-gl</code> package, but make sure to load the CSS manually.
</p>
<pre><code class="language-html">&lt;script src=&quot;https://unpkg.com/maplibre-gl/dist/maplibre-gl.js&quot;&gt;&lt;/script&gt;
&lt;link
href=&quot;https://unpkg.com/maplibre-gl/dist/maplibre-gl.css&quot;
rel=&quot;stylesheet&quot;
/&gt;
</code></pre>
<p>And initialize it to a div, like this:</p>
<pre><code class="language-html">&lt;div id=&quot;map&quot; style=&quot;width: 100%; height: 500px&quot;&gt;&lt;/div&gt;
&lt;script&gt;
const map = new maplibregl.Map({
style: 'https://tiles.openfreemap.org/styles/liberty',
center: [-0.114, 51.506],
zoom: 14.2,
container: 'map';
})
&lt;/script&gt;
</code></pre>
</div>
<div>
<input type="checkbox" id="col2" class="col-chk" />
<label for="col2" class="col-lbl">Using Mapbox?</label>
<div class="col-cnt">
<p>
If you are currently using Mapbox, please change your libraries to
<a href="https://maplibre.org/maplibre-gl-js/docs/" target="_blank">MapLibre GL JS</a>.
MapLibre is based on the last open-source version of Mapbox GL JS, before it went
closed-source. Migrating should be as simple as changing the libraries, as long as you are not
using any features specific to the 2.x or later release.
</p>
</div>
</div>
<div>
<input type="checkbox" id="col3" class="col-chk" />
<label for="col3" class="col-lbl">Using Leaflet?</label>
<div class="col-cnt">
<p>A Leaflet based snippet is coming soon.</p>
</div>
</div>
<div>
<input type="checkbox" id="col4" class="col-chk" />
<label for="col4" class="col-lbl">Mobile apps</label>
<div class="col-cnt">
<p>
For mobile apps, you can use the same style with
<a href="https://maplibre.org/" target="_blank">MapLibre Native</a>.
</p>
</div>
</div>
<div>
<input type="checkbox" id="col6" class="col-chk" />
<label for="col6" class="col-lbl">Custom styles</label>
<div class="col-cnt">
<p>
You can customise the styles using the
<a href="https://maputnik.github.io/" target="_blank">Maputnik</a> editor. For example you can
remove labels, POIs or change colors.
</p>
<p>
When you use a customised style, you need to host the style JSON youself, and use this URL in
MapLibre.
</p>
<p>
<a
href="https://maputnik.github.io/editor?style=https://tiles.openfreemap.org/styles/bright"
target="_blank"
>Customise Bright</a
>
</p>
<p>
<a
href="https://maputnik.github.io/editor?style=https://tiles.openfreemap.org/styles/liberty"
target="_blank"
>Customise Liberty</a
>
</p>
<p>
<a
href="https://maputnik.github.io/editor?style=https://tiles.openfreemap.org/styles/positron"
target="_blank"
>Customise Positron</a
>
</p>
</div>
<div>
<input type="checkbox" id="col5" class="col-chk" />
<label for="col5" class="col-lbl">Self-hosting</label>
<div class="col-cnt">
<p>
You can also download our processed planet MBTiles and BTRFS images if you want to self-host
yourself. Details are in
<a href="https://github.com/hyperknot/openfreemap" target="_blank">GitHub</a>.
</p>
</div>
</div>
</div>

View File

@@ -1,5 +0,0 @@
Choose style:
<button onclick="selectStyle('Bright')">Bright</button>
<button onclick="selectStyle('Liberty')">Liberty</button>
<button onclick="selectStyle('Positron')">Positron</button>

View File

@@ -28,15 +28,5 @@
<script src="https://unpkg.com/prismjs@1.29.0/components/prism-core.min.js"></script> <script src="https://unpkg.com/prismjs@1.29.0/components/prism-core.min.js"></script>
<script src="https://unpkg.com/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script> <script src="https://unpkg.com/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var codeBlocks = document.querySelectorAll('pre')
codeBlocks.forEach(function (block) {
block.classList.add('language-js')
Prism.highlightElement(block)
})
})
</script>
</body> </body>
</html> </html>

View File

@@ -22,76 +22,42 @@ I'm Zsolt Ero ([twitter](https://twitter.com/hyperknot), [blog](https://blog.hyp
## How can I use it? ## How can I use it?
<div id="map"></div> <!--map_docs-->
<!--style_selector-->
Include [MapLibre GL JS](https://maplibre.org/maplibre-gl-js/docs/) in `<head>`
```
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
<link
href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css"
rel="stylesheet"
/>
```
And initialize it to a div, like this:
```
<div id="map" style="width: 100%; height: 500px"></div>
<script>
const map = new maplibregl.Map({
style: 'https://tiles.openfreemap.org/styles/liberty',
center: [-0.114, 51.506],
zoom: 14.2,
container: 'map'
})
</script>
```
If you've used Mapbox GL before, please migrate to MapLibre. It is based on the last open-source version of Mapbox GL, before it went closed-source. A Leaflet based snippet is coming soon.
For mobile apps, you can do the same with [MapLibre Native.](https://maplibre.org/)
You can also download our processed planet MBTiles and BTRFS images if you want to self-host yourself. Details are in the GitHub at [hyperknot/openfreemap](https://github.com/hyperknot/openfreemap).
## How can I donate or support this project? ## How can I donate or support this project?
... ...
## Is commercial usage allowed?
Yes
## Why did you make this?
Because I waited for years for someone to offer this service, but realised no one is going to make it. So, I thought I might use my map hosting experience and do it.
I'll share more about the why in a [blog post](https://blog.hyperknot.com/) in the future, feel free to subscribe.
## How can this work? How can a one person project offer unlimited map hosting for free?
There is no technical reason why vector tile hosting should cost as much as it does today. Vector tiles are just static files. OK, serving 300 million files is not easy, but at the end of the day they are just files.
Financially, the plan is to keep renting Hetzner servers until they cover the bandwidth. I believe it can work if enough people subscribe to the support plans.
If this project helps you to save on your map hosting costs, please consider subscribing to a support plan!
## How can I follow this project? ## How can I follow this project?
twitter: [hyperknot](https://twitter.com/hyperknot) and [OpenFreeMapOrg](https://twitter.com/OpenFreeMapOrg)
The main repo is [hyperknot/openfreemap](https://github.com/hyperknot/openfreemap) The main repo is [hyperknot/openfreemap](https://github.com/hyperknot/openfreemap)
Styles are at [hyperknot/openfreemap-styles](https://github.com/hyperknot/openfreemap-styles) Styles are at [hyperknot/openfreemap-styles](https://github.com/hyperknot/openfreemap-styles)
twitter: [@hyperknot](https://twitter.com/hyperknot)
twitter: [@OpenFreeMapOrg](https://twitter.com/OpenFreeMapOrg)
mastodon zsolt https://elk.zone/sigmoid.social/@hyperknot/followers mastodon zsolt https://elk.zone/sigmoid.social/@hyperknot/followers
mastodon ofm TODO mastodon ofm TODO
## Is commercial usage allowed?
Yes.
## Why did I make this?
Because I waited for years for someone to offer this service, but realised no one is going to make it. So, I thought I might use my map hosting experience and do it.
I'll share more about the why in a blog post in the future, feel free to subscribe on the links above.
## How can this work? How can a one person project offer unlimited map hosting for free?
There is no technical reason why vector tile hosting should cost as much as it does today.
Vector tiles are just static files. OK, serving 300 million files is not easy, but at the end of the day they are just files.
Financially, the plan is to keep buying Hetzner servers until they cover the bandwidth. I believe it can work if enough people contribute. If this project helps you save your map hosting costs, please consider our support plans!
## What is the tech stack? ## What is the tech stack?
The map schema is [OpenMapTiles](https://github.com/openmaptiles/openmaptiles). The map schema is [OpenMapTiles](https://github.com/openmaptiles/openmaptiles).
@@ -104,7 +70,7 @@ The server is nginx on Ubuntu.
There is no cloud, just dedicated servers on Hetzner. There is no cloud, just dedicated servers on Hetzner.
Currently using Cloudflare, but it's designed so that it can be changed any time. Currently using Cloudflare, but it's designed it so it can be changed any time.
Moreover, a lot of work is going into customising the styles at [openfreemap-styles](https://github.com/hyperknot/openfreemap-styles). Moreover, a lot of work is going into customising the styles at [openfreemap-styles](https://github.com/hyperknot/openfreemap-styles).