Skip to content

Introduce integration for mobile documentation #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,29 @@ export default defineConfig({
title: "Protomaps Docs",
head: [
["link", { rel: "icon", type: "image/png", href: "/favicon.png" }],
["link", { rel: "apple-touch-icon", type: "image/jpg", href:"https://protomaps.com//apple-touch-icon.jpg" }],
["meta", { property: "og:image", content: "https://protomaps.com/docs_opengraph.jpg" }]
[
"link",
{
rel: "apple-touch-icon",
type: "image/jpg",
href: "https://protomaps.com//apple-touch-icon.jpg",
},
],
[
"meta",
{
property: "og:image",
content: "https://protomaps.com/docs_opengraph.jpg",
},
],
],
description: "Technical Documentation for Protomaps",
cleanUrls: true,
markdown: {
theme: {
light: 'github-light-high-contrast',
dark: 'github-dark-high-contrast'
}
light: "github-light-high-contrast",
dark: "github-dark-high-contrast",
},
},
themeConfig: {
logo: "/logo.svg",
Expand Down Expand Up @@ -56,6 +69,11 @@ export default defineConfig({
{ text: "OpenLayers", link: "/pmtiles/openlayers" },
],
},
{
text: "PMTiles on mobile",
collapsed: true,
items: [{ text: "MapLibre GL", link: "/pmtiles/maplibre-mobile" }],
},
{
text: "Accelerating PMTiles",
collapsed: true,
Expand Down
46 changes: 46 additions & 0 deletions pmtiles/maplibre-mobile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: PMTiles for MapLibre GL on Mobile
outline: deep
---

# PMTiles for MapLibre GL

Support for PMTiles has been build directly into recent versions of MapLibre GL.

PMTiles is designed to be read directly in the browser by the MapLibre GL renderer, for either thematic overlay tilesets or basemap tilesets.

PMTiles can be used directly in maplibre by installing a using a relatively new version of the library with support built in.

- Android: [v11.8.0](https://github.com/maplibre/maplibre-native/releases/tag/android-v11.8.0)
- iOS: [v6.1.0.1](https://github.com/maplibre/maplibre-native/releases/tag/ios-v6.10.0)
- React Native: [v10.1.0](https://github.com/maplibre/maplibre-react-native/releases)


## React Native

It's worth pointing out that React Native MapLibre is using the iOS/Android versions of MapLibre under the hood which has slightly different APIs than the javascript API on web. Simply use the `pmtiles://...` url directly in react native, there is no need for plugins:

```js
import {
LineLayer,
MapView,
VectorSource,
} from "@maplibre/maplibre-react-native";

export function ExampleMap() {
return (
<MapView style={{ flex: 1 }}>
<VectorSource
id="fireCentreSource"
url="pmtiles://https://nrs.objectstore.gov.bc.ca/lwzrin/psu/pmtiles/fireCentres.pmtiles"
>
<LineLayer
id="border-fire-centres"
sourceLayerID="tippecanoe_input"
style={{ lineColor: "red" }}
/>
</VectorSource>
</MapView>
);
}
```