mirror of
https://github.com/maplibre/martin.git
synced 2024-12-24 23:45:42 +03:00
v0.6rc1, MapLibre docs, (#407)
* Migrate to MapLibre documentation * Changed version to v0.6rc1 getting ready for a release
This commit is contained in:
parent
55e0b9a810
commit
5fb3d50b73
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -968,9 +968,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
|
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jobserver"
|
name = "jobserver"
|
||||||
@ -1047,7 +1047,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "martin"
|
name = "martin"
|
||||||
version = "1.0.0-alpha.0"
|
version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix",
|
"actix",
|
||||||
"actix-cors",
|
"actix-cors",
|
||||||
@ -1195,6 +1195,15 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-src"
|
||||||
|
version = "111.22.0+1.1.1q"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.76"
|
version = "0.9.76"
|
||||||
@ -1204,6 +1213,7 @@ dependencies = [
|
|||||||
"autocfg",
|
"autocfg",
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
|
"openssl-src",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
@ -1711,9 +1721,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.101"
|
version = "1.0.102"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2"
|
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1859,9 +1869,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing"
|
name = "tracing"
|
||||||
version = "0.1.36"
|
version = "0.1.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
|
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"log",
|
"log",
|
||||||
@ -1871,9 +1881,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.29"
|
version = "0.1.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
|
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "martin"
|
name = "martin"
|
||||||
version = "1.0.0-alpha.0"
|
version = "0.6.0-rc.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Stepan Kuzmin <to.stepan.kuzmin@gmail.com>", "MapLibre contributors"]
|
authors = ["Stepan Kuzmin <to.stepan.kuzmin@gmail.com>", "Yuri Astrakhan <YuriAstrakhan@gmail.com>", "MapLibre contributors"]
|
||||||
description = "Blazing fast and lightweight PostGIS vector tiles server"
|
description = "Blazing fast and lightweight PostGIS vector tile server"
|
||||||
repository = "https://github.com/maplibre/martin/"
|
repository = "https://github.com/maplibre/martin"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
108
README.md
108
README.md
@ -12,7 +12,7 @@ Martin is a [PostGIS](https://github.com/postgis/postgis) [vector tiles](https:/
|
|||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [API](#api)
|
- [API](#api)
|
||||||
- [Using with Mapbox GL JS](#using-with-mapbox-gl-js)
|
- [Using with MapLibre GL JS](#using-with-maplibre)
|
||||||
- [Using with Leaflet](#using-with-leaflet)
|
- [Using with Leaflet](#using-with-leaflet)
|
||||||
- [Using with deck.gl](#using-with-deckgl)
|
- [Using with deck.gl](#using-with-deckgl)
|
||||||
- [Table Sources](#table-sources)
|
- [Table Sources](#table-sources)
|
||||||
@ -98,14 +98,11 @@ When started, martin will go through all spatial tables and functions with an ap
|
|||||||
| `GET` | `/rpc/{schema_name}.{function_name}/{z}/{x}/{y}.pbf` | [Function Source Tiles](#function-source-tiles) |
|
| `GET` | `/rpc/{schema_name}.{function_name}/{z}/{x}/{y}.pbf` | [Function Source Tiles](#function-source-tiles) |
|
||||||
| `GET` | `/healthz` | Martin server health check: returns `200 OK` |
|
| `GET` | `/healthz` | Martin server health check: returns `200 OK` |
|
||||||
|
|
||||||
## Using with Mapbox GL JS
|
## Using with MapLibre
|
||||||
|
[MapLibre](https://maplibre.org/projects/maplibre-gl-js/) is an Open-source JavaScript library for showing maps on a website. MapLibre can accept [MVT vector tiles](https://github.com/mapbox/vector-tile-spec) generated by Martin, and applies [a style](https://maplibre.org/maplibre-gl-js-docs/style-spec/) to them to draw a map using Web GL.
|
||||||
|
|
||||||
[Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) is a JavaScript library for interactive, customizable vector maps on the web. It takes map styles that conform to the
|
You can add a layer to the map and specify Martin [TileJSON](https://github.com/mapbox/tilejson-spec) endpoint as a vector source URL. You should also specify a `source-layer` property. For [Table Sources](#table-sources) it is `{schema_name}.{table_name}` by default.
|
||||||
[Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-js/style-spec), applies them to vector tiles that
|
|
||||||
conform to the [Mapbox Vector Tile Specification](https://github.com/mapbox/vector-tile-spec), and renders them using
|
|
||||||
WebGL.
|
|
||||||
|
|
||||||
You can add a layer to the map and specify martin TileJSON endpoint as a vector source URL. You should also specify a `source-layer` property. For [Table Sources](#table-sources) it is `{schema_name}.{table_name}` by default.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
map.addLayer({
|
map.addLayer({
|
||||||
@ -118,7 +115,23 @@ map.addLayer({
|
|||||||
'source-layer': 'public.points',
|
'source-layer': 'public.points',
|
||||||
paint: {
|
paint: {
|
||||||
'circle-color': 'red'
|
'circle-color': 'red'
|
||||||
}
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
map.addSource('rpc', {
|
||||||
|
type: 'vector',
|
||||||
|
url: `http://localhost:3000/rpc/public.function_source.json`
|
||||||
|
});
|
||||||
|
map.addLayer({
|
||||||
|
id: 'points',
|
||||||
|
type: 'circle',
|
||||||
|
source: 'rpc',
|
||||||
|
'source-layer': 'public.function_source',
|
||||||
|
paint: {
|
||||||
|
'circle-color': 'blue'
|
||||||
|
},
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -151,26 +164,6 @@ map.addLayer({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using with MapLibre
|
|
||||||
[MapLibre](https://maplibre.org/projects/maplibre-gl-js/) is an Open-source JavaScript library for publishing maps on your websites. Originated as an open-source fork of [mapbox-gl-js](https://www.mapbox.com/mapbox-gljs), [MapLibre](https://maplibre.org/projects/maplibre-gl-js/) is intended to be a drop-in replacement for the Mapbox’s version with additional functionality.
|
|
||||||
Generally There is no big difference between MapLibre and [mapbox-gl-js](https://www.mapbox.com/mapbox-gljs) when cooperating with Martin.
|
|
||||||
|
|
||||||
```js
|
|
||||||
map.addSource('rpc', {
|
|
||||||
type: 'vector',
|
|
||||||
url: `http://localhost:3000/rpc/public.function_source.json`
|
|
||||||
});
|
|
||||||
map.addLayer({
|
|
||||||
id: 'points',
|
|
||||||
type: 'circle',
|
|
||||||
source: 'rpc',
|
|
||||||
'source-layer': 'public.function_source',
|
|
||||||
paint: {
|
|
||||||
'circle-color': 'blue'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Using with Leaflet
|
## Using with Leaflet
|
||||||
|
|
||||||
[Leaflet](https://github.com/Leaflet/Leaflet) is the leading open-source JavaScript library for mobile-friendly interactive maps.
|
[Leaflet](https://github.com/Leaflet/Leaflet) is the leading open-source JavaScript library for mobile-friendly interactive maps.
|
||||||
@ -220,6 +213,27 @@ const deckgl = new DeckGL({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Using with Mapbox
|
||||||
|
|
||||||
|
[Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) is a JavaScript library for interactive, customizable vector maps on the web. Mapbox GL JS v1.x was open source, and it was forked as MapLibre (see [above](#using-with-maplibre)), so using Martin with Mapbox is similar to MapLibre. Mapbox GL JS can accept [MVT vector tiles](https://github.com/mapbox/vector-tile-spec) generated by Martin, and applies [a style](https://docs.mapbox.com/mapbox-gl-js/style-spec/) to them to draw a map using Web GL.
|
||||||
|
|
||||||
|
You can add a layer to the map and specify martin TileJSON endpoint as a vector source URL. You should also specify a `source-layer` property. For [Table Sources](#table-sources) it is `{schema_name}.{table_name}` by default.
|
||||||
|
|
||||||
|
```js
|
||||||
|
map.addLayer({
|
||||||
|
id: 'public.points',
|
||||||
|
type: 'circle',
|
||||||
|
source: {
|
||||||
|
type: 'vector',
|
||||||
|
url: 'http://localhost:3000/public.points.json'
|
||||||
|
},
|
||||||
|
'source-layer': 'public.points',
|
||||||
|
paint: {
|
||||||
|
'circle-color': 'red'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Table Sources
|
## Table Sources
|
||||||
|
|
||||||
Table Source is a database table which can be used to query [vector tiles](https://github.com/mapbox/vector-tile-spec). When started, martin will go through all spatial tables in the database and build a list of table sources. A table should have at least one geometry column with non-zero SRID. All other table columns will be represented as properties of a vector tile feature.
|
Table Source is a database table which can be used to query [vector tiles](https://github.com/mapbox/vector-tile-spec). When started, martin will go through all spatial tables in the database and build a list of table sources. A table should have at least one geometry column with non-zero SRID. All other table columns will be represented as properties of a vector tile feature.
|
||||||
@ -387,22 +401,32 @@ curl localhost:3000/rpc/public.points/0/0/0.pbf
|
|||||||
You can configure martin using command-line interface
|
You can configure martin using command-line interface
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
Usage:
|
Usage: martin [OPTIONS] [CONNECTION]
|
||||||
martin [options] [<connection>]
|
|
||||||
martin -h | --help
|
Arguments:
|
||||||
martin -v | --version
|
[CONNECTION] Database connection string
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-h --help Show this screen.
|
-c, --config <CONFIG>
|
||||||
-v --version Show version.
|
Path to config file
|
||||||
--config=<path> Path to config file.
|
-k, --keep-alive <KEEP_ALIVE>
|
||||||
--keep-alive=<n> Connection keep alive timeout [default: 75].
|
Connection keep alive timeout. [DEFAULT: 75]
|
||||||
--listen-addresses=<n> The socket address to bind [default: 0.0.0.0:3000].
|
-l, --listen-addresses <LISTEN_ADDRESSES>
|
||||||
--default-srid=<n> If a spatial table has SRID 0, then this default SRID will be used as a fallback.
|
The socket address to bind. [DEFAULT: 0.0.0.0:3000]
|
||||||
--pool-size=<n> Maximum connections pool size [default: 20].
|
-W, --workers <WORKERS>
|
||||||
--workers=<n> Number of web server workers.
|
Number of web server workers
|
||||||
--ca-root-file=<path> Loads trusted root certificates from a file. The file should contain a sequence of PEM-formatted CA certificates.
|
--ca-root-file <CA_ROOT_FILE>
|
||||||
--danger-accept-invalid-certs Trust invalid certificates. This introduces significant vulnerabilities, and should only be used as a last resort.
|
Loads trusted root certificates from a file. The file should contain a sequence of PEM-formatted CA certificates
|
||||||
|
--danger-accept-invalid-certs
|
||||||
|
Trust invalid certificates. This introduces significant vulnerabilities, and should only be used as a last resort
|
||||||
|
-d, --default-srid <DEFAULT_SRID>
|
||||||
|
If a spatial table has SRID 0, then this default SRID will be used as a fallback
|
||||||
|
-p, --pool-size <POOL_SIZE>
|
||||||
|
Maximum connections pool size [DEFAULT: 20]
|
||||||
|
-h, --help
|
||||||
|
Print help information
|
||||||
|
-V, --version
|
||||||
|
Print version information
|
||||||
```
|
```
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
@ -12,6 +12,7 @@ const VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(about, version)]
|
#[command(about, version)]
|
||||||
|
#[clap(disable_colored_help = false)]
|
||||||
pub struct Args {
|
pub struct Args {
|
||||||
/// Database connection string
|
/// Database connection string
|
||||||
pub connection: Option<String>,
|
pub connection: Option<String>,
|
||||||
|
Loading…
Reference in New Issue
Block a user