Skip to content

Instantly share code, notes, and snippets.

@ahocevar
ahocevar / animate.js
Last active March 29, 2020 18:49
Animation sequence for measuring performance of OpenLayers maps
import {fromLonLat} from 'ol/proj.js';
/**
* @param {import("ol/Map").default} map OpenLayers map.
*/
export default function(map) {
const view = map.getView();
const london = fromLonLat([-0.12755, 51.507222]);

Minimal example to reproduce microsoft/TypeScript#34869

git clone https://gist.github.com/b3e58e7eac7750faa235ef66bdb559ab.git
cd b3e58e7eac7750faa235ef66bdb559ab
npm install
npm run build

The last command runs tsc and will output

TypeError: Cannot read property 'valueDeclaration' of undefined

@ahocevar
ahocevar / README.md
Last active October 30, 2019 13:57
ol-mapbox-style example

ol-mapbox-style example

Prerequisites

You need node (version >= 8.0) installed. If you haven't already, download it from https://nodejs.org/.

Downloadind the example

Click the "Download ZIP" button above and unpack the contents. Open a terminal and change to the directory that contains the unpacked files (index.html, index.js and style.json).

@ahocevar
ahocevar / .gitignore
Last active June 26, 2018 21:21
OpenLayers with Webpack and Closure Compiler
node_modules/
bundle.js
style.css
@ahocevar
ahocevar / ol.css
Last active May 3, 2018 13:35
OpenLayers v5.0.0-beta.10
.ol-box {
box-sizing: border-box;
border-radius: 2px;
border: 2px solid blue;
}
.ol-mouse-position {
top: 8px;
right: 8px;
position: absolute;
@ahocevar
ahocevar / .gitignore
Created May 25, 2017 11:52 — forked from tschaub/.gitignore
OpenLayers + Webpack
/node_modules/
bundle.js
@ahocevar
ahocevar / map.geojson
Created June 7, 2016 08:35
gist from regional-monitoring app
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -2,10 +2,11 @@ goog.provide('ol.control.Zoom');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.events');
goog.require('goog.events.EventType');
+goog.require('ol.BrowserFeature');
goog.require('ol.Projection');
goog.require('ol.control.Control');
var recordsToAdd = [],
numRecords = records.length;
function collectRecords(record) {
if (recordsToAdd) {
recordsToAdd.push(record);
}
--numRecords;
if (numRecords === 0) {
this.addLayers(recordsToAdd);
}
@ahocevar
ahocevar / map.geojson
Created July 10, 2015 08:24
gist from regional-monitoring app
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.