• Stars
    star
    164
  • Rank 228,717 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OpenLayers popup overlay

OpenLayers Popup

Basic popup overlay for an 'ol' map. By default the map is centred so that the popup is entirely visible.

Compatible with OpenLayers version 5, 6 and 7 (see note in Install - Parcel, Webpack etc. regarding installing the appropriate version of ol-popup for OpenLayers).

Examples

The examples demonstrate usage and can be viewed online thanks to raw.githack.com:

The source for all examples can be found in examples.

Install

Browser

JS

Load ol-popup.js after OpenLayers. The popup overlay is available as Popup or ol.Overlay.Popup.

<script src="https://unpkg.com/[email protected]"></script>

CSS

<link rel="stylesheet" href="https://unpkg.com/[email protected]/src/ol-popup.css" />

Parcel, Webpack etc.

NPM package: ol-popup.

JS

Install the package via npm

npm install ol-popup --save

⚠️ If you're using the ol package prior to v5 you'll need to install [email protected].

CSS

The CSS file ol-popup.css can be found in ./node_modules/ol-popup/src

To use the popup with the ol package and a module bundler such as Parcel, Webpack etc. see ol-popup-examples.

API

Table of Contents

Popup

Extends Overlay

OpenLayers Popup Overlay. See the examples for usage. Styling can be done via CSS.

Parameters

  • opt_options ol_Overlay_Options? OpenLayers Overlay options, defaults to {autoPan: {animation: {duration: 250}}}

show

Show the popup.

Parameters
  • coord ol_coordinate_Coordinate Where to anchor the popup.
  • html (String | HTMLElement) String or element of HTML to display within the popup.

Returns Popup The Popup instance

hide

Hide the popup.

Returns Popup The Popup instance

isOpened

Indicates if the popup is in open state

Returns Boolean Whether the popup instance is open

Contributing

Contributions are welcome, please create an issue first to discuss any potential contributions.

Updating README.md

The API section of the README.md is generated from the JSDoc comments in the source code. To update the API docs edit the comments in the code then run:

npm run doc

In order to use the doc npm script you will need to install the devDependencies:

npm install --only=dev

License

MIT (c) Matt Walker.

Credit

Based on an example by Tim Schaub posted on the OL3-Dev list.

Also see

If you find the popup useful you might also like the ol-layerswitcher.

More Repositories

1

ol-layerswitcher

Layer control for OpenLayers
JavaScript
382
star
2

python-postgres-testing-demo

A demonstration of writing unit tests for Python functions that perform some action on a Postgres database using testing.postgresql package and nose
Python
19
star
3

ol3-layerswitcher

DEPRECATED - see ol-layerswitcher instead.
JavaScript
12
star
4

dotbin

Local ~/.bin directory
Python
7
star
5

vim-mapfile

MapServer Mapfile syntax highlighting for Vim based on "official" map.vim
Vim Script
7
star
6

ol-layerswitcher-examples

Examples of using ol package and ol-layerswitcher with common JS bundlers
JavaScript
7
star
7

ol3-popup

ol3-popup has been renamed to ol-popup
JavaScript
2
star
8

pyqgis-basics

PyQGIS Talk / Workshop
JavaScript
2
star
9

ol-popup-examples

Examples of using ol package and ol-popup with common JS bundlers
JavaScript
2
star
10

gridref-web

A super simple service to convert an alpha numeric Ordnance Survey grid reference to easting / northing or easting / northing to a grid reference
Clojure
2
star
11

spitslurp

Write text to a file with `spit` and read from a file with `slurp`.
Python
1
star
12

react-layertree

A LayerTree component built using React
JavaScript
1
star
13

longwayaround.org.uk

Personal blog, built with pelican (https://github.com/ametaireau/pelican)
Makefile
1
star
14

links

Toy Reagent bookmark browser
Clojure
1
star
15

longwayaround.org.uk_theme

Pelican theme for personal blog based on the standard pelican theme
CSS
1
star
16

gridref

OS GB Grid Reference to British National Grid Easting / Northing or vice versa
Clojure
1
star
17

clojure-intro

Intro to Clojure based on http://learnxinyminutes.com/docs/clojure/
Clojure
1
star
18

exercism-io-solutions

Solutions to exercism.io exercises, mainly in Clojure
Clojure
1
star