Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/watergis/elastic2mvt
This module generate Mapbox vector tiles from Elasticsearch
https://github.com/watergis/elastic2mvt
elasticsearch vector-tiles
Last synced: about 2 months ago
JSON representation
This module generate Mapbox vector tiles from Elasticsearch
- Host: GitHub
- URL: https://github.com/watergis/elastic2mvt
- Owner: watergis
- License: mit
- Created: 2020-11-20T13:12:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T14:38:44.000Z (over 1 year ago)
- Last Synced: 2024-10-30T05:43:08.468Z (about 2 months ago)
- Topics: elasticsearch, vector-tiles
- Language: JavaScript
- Size: 159 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# elastic2mvt
![Node.js Package](https://github.com/watergis/elastic2mvt/workflows/Node.js%20Package/badge.svg)
![GitHub](https://img.shields.io/github/license/watergis/elastic2mvt)This module generate Mapbox vector tiles from Elasticsearch.
Note. This is still under experimental.
## Install package
```bash
npm install @watergis/elastic2mvt
```## Usage
```js
const elastic2mvt = require('@watergis/elastic2mvt');const es2mvt = new elastic2mvt('localhost:9200');
const z = 14
const x = 9524
const y = 8269
const indices = [
{
// Please specify target Elasticsearch index name
name : 'water_connection',
// specify the size of searching result. Default is 10000.
size: 10000,
// if you don't specify, 'geom' will be used as default column name
geometry: 'geom',
//Please specify your query for Elasticsearch.
// if it is not defined, {"match_all": {}} will be used as default.
query: {
"term": {
"connection_type": "Water Kiosk"
}
}
},
{
name : 'pipeline',
geometry: 'geom'
},
{
name : 'wss',
geometry: 'geom'
}
]
const buffer = await es2mvt.generate(z,x,y,indices)
console.log(buffer)
```## Preparation
Before using this module to convert from Elasticsearch to Mapbox binary vector tile, please insert your GIS data by using `ogr2ogr`. This module adopted `flat` structure of Elasticsearch documents. It maybe does not work for other mapping types of Elastic documents which were inserted by other tools except `ogr2ogr`.The following command is an example to insert from PostGIS.
```
ogr2ogr -f "Elasticsearch" -lco NOT_ANALYZED_FIELDS={ALL} -lco INDEX_NAME=water_connection -lco OVERWRITE=YES http://localhost:9200 "PG:host='localhost' port=5432 user='postgres' dbname='rwss_assets' password='password'" water_connection -skipfailures
```## License
This module is under MIT license.
---
`Copyright (c) 2020 Jin IGARASHI`