Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
eb2878ec6a
|
|||
|
602cc44ae2
|
|||
|
b9615d7b97
|
|||
|
63e644c85a
|
|||
|
d8e893a5f0
|
|||
|
39ca1f18db
|
|||
|
8ac75935ac
|
|||
|
aa2d0ed58b
|
@@ -1,7 +1,11 @@
|
|||||||
# @remotestorage/module-places
|
# @remotestorage/module-places
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/@remotestorage/module-places)
|
||||||
|
|
||||||
This module allows you to manage saved places (Points of Interest) using the [remoteStorage](https://remotestorage.io/) protocol.
|
This module allows you to manage saved places (Points of Interest) using the [remoteStorage](https://remotestorage.io/) protocol.
|
||||||
|
|
||||||
|
It leverages [Geohashes](https://www.geohash.es/) to organize data, enabling efficient retrieval of places within specific geographic areas. This structure is particularly optimized for map applications that need to load data only for the visible viewport.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -31,6 +35,10 @@ await places.store({
|
|||||||
// List all places
|
// List all places
|
||||||
const allPlaces = await places.getPlaces();
|
const allPlaces = await places.getPlaces();
|
||||||
console.log(allPlaces);
|
console.log(allPlaces);
|
||||||
|
|
||||||
|
// List places for specific geohash prefixes (e.g. for a map view)
|
||||||
|
const areaPlaces = await places.getPlaces(['u33d', 'u33e']);
|
||||||
|
console.log(areaPlaces);
|
||||||
```
|
```
|
||||||
|
|
||||||
## API Reference
|
## API Reference
|
||||||
|
|||||||
2
dist/places.d.ts
vendored
2
dist/places.d.ts
vendored
@@ -83,7 +83,7 @@ export interface PlacesClient {
|
|||||||
/**
|
/**
|
||||||
* Store a place.
|
* Store a place.
|
||||||
* Generates ID and Geohash if missing.
|
* Generates ID and Geohash if missing.
|
||||||
* Path structure: <geohash-prefix-2>/<geohash-prefix-2>/<id>
|
* Path structure: `<geohash-prefix-2>/<geohash-prefix-2>/<id>`
|
||||||
*
|
*
|
||||||
* @param placeData - The data of the place to store.
|
* @param placeData - The data of the place to store.
|
||||||
* @returns The stored place object.
|
* @returns The stored place object.
|
||||||
|
|||||||
2
dist/places.js
vendored
2
dist/places.js
vendored
@@ -71,7 +71,7 @@ const Places = function (privateClient /*, publicClient: BaseClient */) {
|
|||||||
/**
|
/**
|
||||||
* Store a place.
|
* Store a place.
|
||||||
* Generates ID and Geohash if missing.
|
* Generates ID and Geohash if missing.
|
||||||
* Path structure: <geohash-prefix-2>/<geohash-prefix-2>/<id>
|
* Path structure: `<geohash-prefix-2>/<geohash-prefix-2>/<id>`
|
||||||
*/
|
*/
|
||||||
store: async function (placeData) {
|
store: async function (placeData) {
|
||||||
const place = preparePlace(placeData);
|
const place = preparePlace(placeData);
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ The geohash of the place.
|
|||||||
|
|
||||||
Store a place.
|
Store a place.
|
||||||
Generates ID and Geohash if missing.
|
Generates ID and Geohash if missing.
|
||||||
Path structure: <geohash-prefix-2>/<geohash-prefix-2>/<id>
|
Path structure: `<geohash-prefix-2>/<geohash-prefix-2>/<id>`
|
||||||
|
|
||||||
#### Parameters
|
#### Parameters
|
||||||
|
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@remotestorage/module-places",
|
"name": "@remotestorage/module-places",
|
||||||
"version": "1.1.0",
|
"version": "1.1.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@remotestorage/module-places",
|
"name": "@remotestorage/module-places",
|
||||||
"version": "1.1.0",
|
"version": "1.1.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"latlon-geohash": "^2.0.0",
|
"latlon-geohash": "^2.0.0",
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -1,7 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@remotestorage/module-places",
|
"name": "@remotestorage/module-places",
|
||||||
"version": "1.1.0",
|
"version": "1.1.3",
|
||||||
"description": "Manage favorite/saved places",
|
"description": "Manage favorite/saved places",
|
||||||
|
"homepage": "https://gitea.kosmos.org/raucao/remotestorage-module-places#remotestoragemodule-places",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://gitea.kosmos.org/raucao/remotestorage-module-places.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"remotestorage",
|
||||||
|
"remotestorage-module"
|
||||||
|
],
|
||||||
"main": "dist/places.js",
|
"main": "dist/places.js",
|
||||||
"types": "dist/places.d.ts",
|
"types": "dist/places.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export interface PlacesClient {
|
|||||||
/**
|
/**
|
||||||
* Store a place.
|
* Store a place.
|
||||||
* Generates ID and Geohash if missing.
|
* Generates ID and Geohash if missing.
|
||||||
* Path structure: <geohash-prefix-2>/<geohash-prefix-2>/<id>
|
* Path structure: `<geohash-prefix-2>/<geohash-prefix-2>/<id>`
|
||||||
*
|
*
|
||||||
* @param placeData - The data of the place to store.
|
* @param placeData - The data of the place to store.
|
||||||
* @returns The stored place object.
|
* @returns The stored place object.
|
||||||
@@ -157,7 +157,7 @@ const Places = function (
|
|||||||
/**
|
/**
|
||||||
* Store a place.
|
* Store a place.
|
||||||
* Generates ID and Geohash if missing.
|
* Generates ID and Geohash if missing.
|
||||||
* Path structure: <geohash-prefix-2>/<geohash-prefix-2>/<id>
|
* Path structure: `<geohash-prefix-2>/<geohash-prefix-2>/<id>`
|
||||||
*/
|
*/
|
||||||
store: async function (placeData: Partial<Place>) {
|
store: async function (placeData: Partial<Place>) {
|
||||||
const place = preparePlace(placeData);
|
const place = preparePlace(placeData);
|
||||||
|
|||||||
Reference in New Issue
Block a user