From 0af48cfac15f8f256a04e2d9b925a233cc9fb786 Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Thu, 11 Jan 2024 20:08:56 +0100 Subject: [PATCH] website --- website/assets/style.css | 78 +++++++- website/generate.py | 3 + website/index.html | 372 ++++++++++++++++-------------------- website/map.js | 11 +- website/map_docs.html | 122 ++++++++++++ website/style_selector.html | 5 - website/template.html | 10 - website/text.md | 78 +++----- 8 files changed, 400 insertions(+), 279 deletions(-) create mode 100644 website/map_docs.html delete mode 100644 website/style_selector.html diff --git a/website/assets/style.css b/website/assets/style.css index cc08ffb..85ddf5b 100644 --- a/website/assets/style.css +++ b/website/assets/style.css @@ -25,6 +25,27 @@ select { 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 --- */ body { @@ -45,7 +66,8 @@ h2, h3, h4, h5, -h6 { +h6, +.col-lbl { color: #555; max-width: 600px; margin: 1em auto 0.5em; @@ -58,6 +80,14 @@ h6 { a { 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 { @@ -78,7 +108,7 @@ pre { background: #efefef; max-width: 800px; - margin: 0 auto 0.6em; + margin: 0 auto 0.6em !important; font-size: 14px; } @@ -93,3 +123,47 @@ code { height: 500px; 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: '▼'; +} diff --git a/website/generate.py b/website/generate.py index 3c9ae75..06f12b5 100755 --- a/website/generate.py +++ b/website/generate.py @@ -14,6 +14,9 @@ def generate(): template = open('template.html').read() template = template.replace('{text}', text_html) + style_selector = open('map_docs.html').read() + template = template.replace('', style_selector) + open('index.html', 'w').write(template) diff --git a/website/index.html b/website/index.html index c4671fe..5375605 100644 --- a/website/index.html +++ b/website/index.html @@ -23,237 +23,199 @@

OpenFreeMap

-

What is this?

-

OpenFreeMap is an open and free OpenStreetMap tile hosting service.

-

- 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. -

-

It's truly open source: everything, including the full production setup is on GitHub.

-

Why is this important?

-

- 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. -

-

- 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 - *. -

-

You can try self-hosting, but it requires a big server and a lot of time to get it right.

-

Who is behind this project?

-

- I'm Zsolt Ero (twitter, - blog). I've created - MapHub and I've been running map hosting in production for 8 - years. -

-

How can I use it?

-
- -

- Include MapLibre GL JS in - <head> -

-
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
+

What is this?

+

OpenFreeMap is an open and free OpenStreetMap tile hosting service.

+

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.

+

It's truly open source: everything, including the full production setup is on GitHub.

+

Why is this important?

+

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.

+

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 *.

+

You can try self-hosting, but it requires a big server and a lot of time to get it right.

+

Who is behind this project?

+

I'm Zsolt Ero (twitter, blog). I've created MapHub and I've been running map hosting in production for 8 years.

+

How can I use it?

+
+ +

+ Choose style: + + + +

+

+ Use the following style in a MapLibre map: + https://tiles.openfreemap.org/styles/liberty +

+ + + +
+

+ Include + MapLibre GL JS in the + <head>. If you are using npm, you can install the + maplibre-gl package, but make sure to load the CSS manually. +

+
<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>
+  

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',
+    style: 'https://tiles.openfreemap.org/styles/liberty',
     center: [-0.114, 51.506],
     zoom: 14.2,
-    container: 'map'
+    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. + If you are currently using Mapbox, please change your libraries to + MapLibre GL JS. + 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. +

+
+
+ +
+ + +
+

A Leaflet based snippet is coming soon.

+
+
+ +
+ + +
+

+ For mobile apps, you can use the same style with + MapLibre Native. +

+
+
+ +
+ + +
+

+ You can customise the styles using the + Maputnik editor. For example you can + remove labels, POIs or change colors.

- For mobile apps, you can do the same with MapLibre Native. + When you use a customised style, you need to host the style JSON youself, and use this URL in + MapLibre.

- 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. -

-

How can I donate or support this project?

-

...

-

How can I follow this project?

-

- The main repo is hyperknot/openfreemap + Customise Bright

- Styles are at - hyperknot/openfreemap-styles -

-

twitter: @hyperknot

-

twitter: @OpenFreeMapOrg

-

mastodon zsolt https://elk.zone/sigmoid.social/@hyperknot/followers

-

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. + Customise Liberty

- 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?

-

- The map schema is OpenMapTiles. -

-

- The tiles are generated by Planetiler. -

-

- There is no tile server running, only BTRFS partition images with 300 million hard linked - files. -

-

The server is nginx on Ubuntu.

-

There is no cloud, just dedicated servers on Hetzner.

-

Currently using Cloudflare, but it's designed so that it can be changed any time.

-

- Moreover, a lot of work is going into customising the styles at - openfreemap-styles. -

-

What about PMTiles?

-

I would have loved to use PMTiles, they are a brilliant idea!

-

- Unfortunately, making range requests in 80 GB files is just not working in production. They - are fine for < 500 MB files, but have terrible latency and caching issues for full planet - datasets. -

-

Attribution

-

If you are using MapLibre, attributions are automatically added.

-

If you are using this in a printed media or video, please attribute:

-

- OpenFreeMap - © OpenMapTiles Data from - OpenStreetMap -

-

You don't need to display the OpenFreeMap part, but it's nice if you do.

-

Licenses

-

- The license of this project is - MIT. -

-

Map data is from OpenStreetMap.

-

- OpenMapTiles code is released under - the - BSD 3-Clause License, design under CC BY 4.0. - LICENSE.md. -

-

Styles

-

Bright

-

- Fork from - openmaptiles/osm-bright-gl-style. The OSM Bright GL Style is derived from - Mapbox Open Styles. The OSM Bright GL - Style’s code is released under the - BSD 3-Clause License. The OSM Bright GL Style’s design is released under - CC BY 4.0. - LICENSE.md. -

-

Liberty

-

- Fork from maputnik/osm-liberty. OSM - Liberty is a fork of OSM Bright. The OSM Bright GL Style is derived from - Mapbox Open Styles. The OSM Bright GL - Style’s code is released under the - BSD 3-Clause License. The OSM Bright GL Style’s design is released under - CC BY 4.0. - LICENSE.md. -

-

Positron

-

- Fork from - openmaptiles/positron-gl-style. The Positron GL Style is derived from - CartoDB Basemaps designed by Stamen - and Paul Norman for CartoDB Inc., licensed under - CC BY 3.0. The Positron GL style’s - code is released under the - BSD 3-Clause License. The Positron GL Style’s design is released under - CC BY 4.0. - LICENSE.md. -

-

Fonts

-

- Noto Sans is released under the - SIL Open Font License, Version 1.1 -

-

Icons

-

- The Maki POI icon set is - licensed under CC0 1.0 Universal. -

-

- The right arrow was derived from - Wikipedia, it is public - domain. -

-

Natural Earth

-

- Natural Earth map data is in the public - domain. -

-

Tools

-

- spritezero-cli is from - mapbox/spritezero-cli, licensed - ISC. + Customise Positron

+
+ +
+ + +
+

+ You can also download our processed planet MBTiles and BTRFS images if you want to self-host + yourself. Details are in + GitHub. +

+
+
+
+ +

How can I donate or support this project?

+

...

+

How can I follow this project?

+

twitter: hyperknot and OpenFreeMapOrg

+

The main repo is hyperknot/openfreemap

+

Styles are at hyperknot/openfreemap-styles

+

mastodon zsolt https://elk.zone/sigmoid.social/@hyperknot/followers

+

mastodon ofm TODO

+

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 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 a lot on your map hosting costs, please consider subscribing to a support plan!

+

What is the tech stack?

+

The map schema is OpenMapTiles.

+

The tiles are generated by Planetiler.

+

There is no tile server running, only BTRFS partition images with 300 million hard linked files.

+

The server is nginx on Ubuntu.

+

There is no cloud, just dedicated servers on Hetzner.

+

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.

+

What about PMTiles?

+

I would have loved to use PMTiles, they are a brilliant idea!

+

Unfortunately, making range requests in 80 GB files is just not working in production. They are fine for < 500 MB files, but have terrible latency and caching issues for full planet datasets.

+

Attribution

+

If you are using MapLibre, attributions are automatically added.

+

If you are using this in a printed media or video, please attribute:

+

OpenFreeMap © OpenMapTiles Data from OpenStreetMap

+

You don't need to display the OpenFreeMap part, but it's nice if you do.

+

Licenses

+

The license of this project is MIT.

+

Map data is from OpenStreetMap.

+

OpenMapTiles code is released under the BSD 3-Clause License, design under CC BY 4.0. LICENSE.md.

+

Styles

+

Bright

+

Fork from openmaptiles/osm-bright-gl-style. The OSM Bright GL Style is derived from Mapbox Open Styles. The OSM Bright GL Style’s code is released under the BSD 3-Clause License. The OSM Bright GL Style’s design is released under CC BY 4.0. LICENSE.md.

+

Liberty

+

Fork from maputnik/osm-liberty. OSM Liberty is a fork of OSM Bright. The OSM Bright GL Style is derived from Mapbox Open Styles. The OSM Bright GL Style’s code is released under the BSD 3-Clause License. The OSM Bright GL Style’s design is released under CC BY 4.0. LICENSE.md.

+

Positron

+

Fork from openmaptiles/positron-gl-style. The Positron GL Style is derived from CartoDB Basemaps designed by Stamen and Paul Norman for CartoDB Inc., licensed under CC BY 3.0. The Positron GL style’s code is released under the BSD 3-Clause License. The Positron GL Style’s design is released under CC BY 4.0. LICENSE.md.

+

Fonts

+

Noto Sans is released under the SIL Open Font License, Version 1.1

+

Icons

+

The Maki POI icon set is licensed under CC0 1.0 Universal.

+

The right arrow was derived from Wikipedia, it is public domain.

+

Natural Earth

+

Natural Earth map data is in the public domain.

+

Tools

+

spritezero-cli is from mapbox/spritezero-cli, licensed ISC.

+ - - diff --git a/website/map.js b/website/map.js index 880a7a9..c43d8e9 100644 --- a/website/map.js +++ b/website/map.js @@ -16,4 +16,13 @@ map.addControl(nav, 'top-right') let scale = new maplibregl.ScaleControl() 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 +} diff --git a/website/map_docs.html b/website/map_docs.html new file mode 100644 index 0000000..5cb8de2 --- /dev/null +++ b/website/map_docs.html @@ -0,0 +1,122 @@ +
+ +

+ Choose style: + + + +

+

+ Use the following style in a MapLibre map: + https://tiles.openfreemap.org/styles/liberty +

+ + + +
+

+ Include + MapLibre GL JS in the + <head>. If you are using npm, you can install the + maplibre-gl package, but make sure to load the CSS manually. +

+
<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 are currently using Mapbox, please change your libraries to + MapLibre GL JS. + 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. +

+
+
+ +
+ + +
+

A Leaflet based snippet is coming soon.

+
+
+ +
+ + +
+

+ For mobile apps, you can use the same style with + MapLibre Native. +

+
+
+ +
+ + +
+

+ You can customise the styles using the + Maputnik editor. For example you can + remove labels, POIs or change colors. +

+

+ When you use a customised style, you need to host the style JSON youself, and use this URL in + MapLibre. +

+

+ Customise Bright +

+

+ Customise Liberty +

+

+ Customise Positron +

+
+ +
+ + +
+

+ You can also download our processed planet MBTiles and BTRFS images if you want to self-host + yourself. Details are in + GitHub. +

+
+
+
diff --git a/website/style_selector.html b/website/style_selector.html deleted file mode 100644 index 0e9a6b2..0000000 --- a/website/style_selector.html +++ /dev/null @@ -1,5 +0,0 @@ -Choose style: - - - - diff --git a/website/template.html b/website/template.html index 32e37a3..fa54734 100644 --- a/website/template.html +++ b/website/template.html @@ -28,15 +28,5 @@ - - diff --git a/website/text.md b/website/text.md index 98fc60e..daf75a4 100644 --- a/website/text.md +++ b/website/text.md @@ -22,76 +22,42 @@ I'm Zsolt Ero ([twitter](https://twitter.com/hyperknot), [blog](https://blog.hyp ## How can I use it? -
- - - -Include [MapLibre GL JS](https://maplibre.org/maplibre-gl-js/docs/) in `` - -``` - - -``` - -And initialize it to a div, like this: - -``` -
- -``` - -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? ... +## 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? +twitter: [hyperknot](https://twitter.com/hyperknot) and [OpenFreeMapOrg](https://twitter.com/OpenFreeMapOrg) + The main repo is [hyperknot/openfreemap](https://github.com/hyperknot/openfreemap) 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 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? 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. -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).