npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ol-couchdb-source

v2.1.0

Published

Open Layers vector source for reading GeoJSON documents from CouchDB

Downloads

15

Readme

ol-couchdb-source

OpenLayers source for fetching and displaying GeoJSON documents from a CouchDB server.

Prerequisites

  • OpenLayers Library for creating interactive maps on the web.
  • CouchDB (or compatible) database server.

CouchDB document format

Documents are expected to be a valid GeoJSON feature.

Example

{
  "_id": "b98c7d39-f556-4ead-ac3a-86133c66978a",
  "_rev": "1-e4774e4ee81042448f007d7d987b99d1",
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Point",
    "coordinates": [
      -27.773437499999996,
      21.94304553343818
    ]
  }
}

Attachments

Attachments will generate a property in the Feature properties object with the filename as the key and the full path to the file as the value.

Installation

npm install notnotse/ol-couchdb-source

Minimal example

Complete example can be found in the examples folder.

import Map from "ol/Map"
import VectorLayer from "ol/layer/Vector"
import View from "ol/View"
import { CouchDBVectorSource } from "ol-couchdb-source"

const map = new Map({
  layers: [
    new VectorLayer({
      source: CouchDBVectorSource("https://server/database")
    })
  ],
  target: "map",
  view: new View()
})

API

CouchDBVectorSource

CouchDBVectorSource(databaseUrl, opt_options)

Options

| Name | Type | Default | Description | | -------------- | ------------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------ | | dataProjection | ol.ProjectionLike | undefined | Projection of the data we are reading. A projection as ol.proj.Projection or a SRS identifier string | | fetch | Object | undefined | Optional options to add to all fetch requests. | | replication | bool | undefined | Start live replication. |

Example

CouchDBVectorSource("https://localhost:3000/geodata", {
  dataProjection: "EPSG:4326"
})

.update()

Clear all geometries and fetch new data from server.

Example

const couchSource = CouchDBVectorSource("https://localhost:3000/geodata")
couchSource.update()

.replication.start()

Start live replication

Example

const couchSource = CouchDBVectorSource("https://localhost:3000/geodata")
couchSource.replication.start()

.replication.stop()

Stop live replication

Example

const couchSource = CouchDBVectorSource("https://localhost:3000/geodata")
couchSource.replication.stop()

Development

  • npm start - Spins up webpack server on http://localhost:8080 and a PouchDB (CouchDB compatible) in memory server at http://localhost:3000/_utils.
  • npm run deploy- Compiles your application to the lib folder.