# react-ol

> React interface for openlayers

Latest version **0.1.12** (published 2017-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-ol
pnpm add react-ol
yarn add react-ol
bun add react-ol
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.12 |
| Published | 2017-12-18 |
| First published | 2017-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | richard.hills@gmail.com |
| Maintainers | ansgar |

## Links

- npm: https://www.npmjs.com/package/react-ol
- Repository: https://github.com/elbstack/react-ol
- Homepage: https://github.com/elbstack/react-ol#readme
- Issues: https://github.com/elbstack/react-ol/issues
- npm.io page: https://npm.io/package/react-ol

## Dependencies (2)

- [openlayers](https://npm.io/package/openlayers.md) ^4.0.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10

## Recent versions

- 0.1.12 (latest) — 2017-12-18
- 0.1.11 — 2017-12-18
- 0.1.10 — 2017-12-12
- 0.1.9 — 2017-10-30
- 0.1.8 — 2017-10-30
- 0.1.7 — 2017-10-30
- 0.1.6 — 2017-10-30
- 0.1.5 — 2017-10-27

## README

A thin wrapper for [OpenLayers3](http://openlayers.org/) in [React](https://facebook.github.io/react/).

The goal is to be able to write applications using OpenLayers maps in a declarative way. For example, the following is JSX, which can be returned by the render() method on a React component, to generate a map with a red square near the equator.

    <Map view=<View resolution={10000} center={[0, 0]}/>>
      <layer.Tile>
        <source.OSM />
      </layer.Tile>
      <layer.Vector>
        <source.Vector>
          <Feature style={{stroke: {color: [255, 0, 0, 1]}}}>
            <geom.LineString>
              {[[0, 0], [100000, 0], [100000, 100000], [0, 100000]]}
            </geom.LineString>
          </Feature>
        </source.Vector>
      </layer.Vector>
    </Map>

To understand what each element does, read the [OpenLayers API documentation](http://openlayers.org/en/v3.11.2/apidoc/).

### Styles

Are declared using a JSON object, passing through the properties you'd like on the final object.

When creating an Icon, Circle or RegularShape, a `type` parameter must be present, with the value of `icon`, `circle`, or `regular-shape`.

Example:

```
image: {
    type: 'circle',
    radius: 10,
    fill: { color: '#666666' },
    stroke: { color: '#bada55', width: 1 }
}
```

It's early days! If you're familiar with react and/or openlayers and are interested in helping, please get in touch. Available on [github](https://github.com/elbstack/react-ol) and [npm](https://www.npmjs.com/package/react-ol).

I am especially interested in assistance with having each component be optionally [controlled](https://facebook.github.io/react/docs/forms.html#controlled-components). This would allow binding of the components with, say, Redux and for sophisticated state management outside of OpenLayers.

---
_Source: https://npm.io/package/react-ol · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
