Compare commits

..

1 Commits

Author SHA1 Message Date
Tim Schaub
8046a2acc1 3.19.0-beta.1 2016-09-26 09:48:42 -06:00
190 changed files with 4522 additions and 6759 deletions

View File

@@ -77,7 +77,7 @@ Then, just point your browser <http://localhost:3000/build/examples> in your bro
Run examples against the `ol.js` standalone build:
The examples can also be run against the `ol.js` standalone build, just like
the examples [hosted](https://openlayers.org/en/master/examples/) on GitHub.
the examples [hosted](http://openlayers.org/en/master/examples/) on GitHub.
Start by executing the `host-examples` build target:
$ make host-examples

View File

@@ -1,14 +1,14 @@
# OpenLayers 3
[![Travis CI Status](https://secure.travis-ci.org/openlayers/ol3.svg)](http://travis-ci.org/#!/openlayers/ol3)
[![Coverage Status](https://coveralls.io/repos/github/openlayers/ol3/badge.svg?branch=master)](https://coveralls.io/github/openlayers/ol3?branch=master)
[![Coverage Status](https://coveralls.io/repos/openlayers/ol3/badge.svg?branch=master)](https://coveralls.io/r/openlayers/ol3?branch=master)
[![OSGeo Project](https://img.shields.io/badge/OSGeo-Project-brightgreen.svg)](http://osgeo.org/)
[OpenLayers 3](https://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web. It can display map tiles, vector data and markers loaded from any source on any web page. OpenLayers has been developed to further the use of geographic information of all kinds. It is completely free, Open Source JavaScript, released under the 2-clause BSD License (also known as the FreeBSD).
[OpenLayers 3](http://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web. It can display map tiles, vector data and markers loaded from any source on any web page. OpenLayers has been developed to further the use of geographic information of all kinds. It is completely free, Open Source JavaScript, released under the 2-clause BSD License (also known as the FreeBSD).
## Getting Started
- Download the [latest release](https://openlayers.org/download/)
- Download the [latest release](http://openlayers.org/download/)
- Install with npm: `npm install openlayers`
- Clone the repo: `git clone git@github.com:openlayers/ol3.git`
@@ -18,7 +18,7 @@ OpenLayers runs on all modern browsers that support [HTML5](https://html.spec.wh
## Documentation
Check out the [hosted examples](https://openlayers.org/en/latest/examples/), the [workshop](https://openlayers.org/workshop/) or the [API documentation](https://openlayers.org/en/latest/apidoc/).
Check out the [hosted examples](http://openlayers.org/en/latest/examples/), the [workshop](http://openlayers.org/workshop/) or the [API documentation](http://openlayers.org/en/latest/apidoc/).
## Bugs

View File

@@ -1,54 +1,5 @@
## Upgrade notes
### Next release
#### Use `view.animate()` instead of `map.beforeRender()` and `ol.animation` functions
The `map.beforeRender()` and `ol.animation` functions have been deprecated in favor of a new `view.animate()` function. Use of the deprecated functions will result in a warning during development. These functions are subject to removal in an upcoming release.
For details on the `view.animate()` method, see the API docs and the view animation example. Upgrading should be relatively straightforward. For example, if you wanted to have an animated pan, zoom, and rotation previously, you might have done this:
```js
var zoom = ol.animation.zoom({
resolution: view.getResolution()
});
var pan = ol.animation.pan({
source: view.getCenter()
});
var rotate = ol.animation.rotate({
rotation: view.getRotation()
});
map.beforeRender(zoom, pan, rotate);
map.setZoom(1);
map.setCenter([0, 0]);
map.setRotation(Math.PI);
```
Now, the same can be accomplished with this:
```js
view.animate({
zoom: 1,
center: [0, 0],
rotation: Math.PI
});
```
### v3.19.1
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
The origin for gradients and patterns has changed from `[0, 0]` to the top-left
corner of the extent of the geometry being filled.
### v3.19.0
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
Previously, gradients and patterns were aligned with the canvas, so they did not
move and rotate with the map. This was changed to a more expected behavior by anchoring the fill to the map origin (usually at map coordinate `[0, 0]`).
#### `goog.DEBUG` define was renamed to `ol.DEBUG`
As last step in the removal of the dependency on Google Closure Library, the `goog.DEBUG` compiler define was renamed to `ol.DEBUG`. Please change accordingly in your custom build configuration json files.
@@ -71,7 +22,6 @@ A number of internal types have been renamed. This will not affect those who us
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
* rename `ol.control.MousePositionProperty` to `ol.control.MousePosition.Property`
* rename `ol.format.IGCZ` to `ol.format.IGC.Z`
* rename `ol.interaction.InteractionProperty` to `ol.interaction.Interaction.Property`
* rename `ol.interaction.DrawMode` to `ol.interaction.Draw.Mode`
* rename `ol.interaction.DrawEvent` to `ol.interaction.Draw.Event`
* rename `ol.interaction.DrawEventType` to `ol.interaction.Draw.EventType`
@@ -92,7 +42,6 @@ A number of internal types have been renamed. This will not affect those who us
* rename `ol.MapProperty` to `ol.Map.Property`
* rename `ol.ModifyEventType` to `ol.interaction.Modify.EventType`
* rename `ol.RendererType` to `ol.renderer.Type`
* rename `ol.render.EventType` to `ol.render.Event.Type`
* rename `ol.source.ImageEvent` to `ol.source.Image.Event`
* rename `ol.source.ImageEventType` to `ol.source.Image.EventType`
* rename `ol.source.RasterEvent` to `ol.source.Raster.Event`
@@ -114,7 +63,7 @@ The DOM renderer has been removed. Instead, the Canvas renderer should be used.
#### Changes in the way assertions are handled
Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on https://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks in debug mode when the `goog.DEBUG` compiler flag is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.'
Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on http://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks in debug mode when the `goog.DEBUG` compiler flag is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.'
#### Removal of `ol.ENABLE_NAMED_COLORS`
@@ -223,7 +172,7 @@ var v3source = new ol.source.TileUTFGrid({
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `classList` polyfill for IE 9 support. See https://cdn.polyfill.io/v2/docs/features#Element_prototype_classList.
As of this release, OpenLayers requires a `classList` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features#Element_prototype_classList.
#### Immediate rendering API
@@ -272,7 +221,7 @@ The default cache size is `2048`.
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See https://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
#### Layer pre-/postcompose event changes
@@ -590,7 +539,7 @@ now specify an `extent` instead of `widths`. These settings are used to restrict
});
```
See https://openlayers.org/en/master/examples/vector-layer.html for a real example.
See http://openlayers.org/en/master/examples/vector-layer.html for a real example.
Note that you no longer need to set a `projection` on the source!
@@ -612,7 +561,7 @@ now specify an `extent` instead of `widths`. These settings are used to restrict
The above code uses jQuery to send an Ajax request, but you can obviously use any Ajax library.
See https://openlayers.org/en/master/examples/igc.html for a real example.
See http://openlayers.org/en/master/examples/igc.html for a real example.
* Note about KML
@@ -670,9 +619,9 @@ now specify an `extent` instead of `widths`. These settings are used to restrict
});
```
See https://openlayers.org/en/master/examples/vector-osm.html for a real example.
See http://openlayers.org/en/master/examples/vector-osm.html for a real example.
* The experimental `ol.loadingstrategy.createTile` function has been renamed to `ol.loadingstrategy.tile`. The signature of the function hasn't changed. See https://openlayers.org/en/master/examples/vector-osm.html for an example.
* The experimental `ol.loadingstrategy.createTile` function has been renamed to `ol.loadingstrategy.tile`. The signature of the function hasn't changed. See http://openlayers.org/en/master/examples/vector-osm.html for an example.
#### Change to `ol.style.Icon`

View File

@@ -17,7 +17,7 @@ The v3.14.0 release includes features and fixes from 93 pull requests since the
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See https://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
As of this release, OpenLayers requires a `requestAnimationFrame`/`cancelAnimationFrame` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features/#requestAnimationFrame.
#### Layer pre-/postcompose event changes

View File

@@ -18,7 +18,7 @@ The v3.15.0 release includes features and fixes from 136 pull requests since the
#### Internet Explorer 9 support
As of this release, OpenLayers requires a `classList` polyfill for IE 9 support. See https://cdn.polyfill.io/v2/docs/features#Element_prototype_classList.
As of this release, OpenLayers requires a `classList` polyfill for IE 9 support. See http://cdn.polyfill.io/v2/docs/features#Element_prototype_classList.
#### Immediate rendering API

View File

@@ -14,7 +14,7 @@ The v3.18.0 release includes features and fixes from almost 120 pull requests si
#### Changes in the way assertions are handled
Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on https://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks in debug mode when the `goog.DEBUG` compiler flag is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.'
Previously, minified builds of the library did not have any assertions. This caused applications to fail silently or with cryptic stack traces. Starting with this release, developers get notified of many runtime errors through the new `ol.AssertionError`. This error has a `code` property. The meaning of the code can be found on http://openlayers.org/en/latest/doc/errors/. There are additional console assertion checks in debug mode when the `goog.DEBUG` compiler flag is `true`. As this is `true` by default, it is recommended that those creating custom builds set this to `false` so these assertions are stripped.'
#### Removal of `ol.ENABLE_NAMED_COLORS`

View File

@@ -1,203 +0,0 @@
# v3.19.0
## Summary
The v3.19.0 release includes features and fixes from a little more than 120 pull requests with more than 380 commits. Most of the changes are bug fixes, documentation enhancements or target the continuing removal of the dependency on Closure Library. Some notable new or enhanced features are:
* Vector fills with `CanvasGradient` or `CanvasPattern` now move and rotate with the map which is far more intuitive ([#5950](https://github.com/openlayers/ol3/pull/5950))
* Drawing in `freehand`-mode also became more intuitive ([#5970](https://github.com/openlayers/ol3/pull/5970), [#5973](https://github.com/openlayers/ol3/pull/5973), [#5975](https://github.com/openlayers/ol3/pull/5975))
* When tiles of different resolutions are combined for a layer (which is the case before all tiles of the best resolution have been loaded), lower resolution tiles now align with higher resolution tiles resulting in a map without gaps ([#5890](https://github.com/openlayers/ol3/pull/5890))
* Styles can now easily be cloned ([#5832](https://github.com/openlayers/ol3/pull/5832))
Additionally the [openlayers.org](https://openlayers.org) homepage is now available via the `https`-protocol.
## Upgrade notes
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
Previously, gradients and patterns were aligned with the canvas, so they did not
move and rotate with the map. This was changed to a more expected behavior by anchoring the fill to the map origin (usually at map coordinate `[0, 0]`).
#### `goog.DEBUG` define was renamed to `ol.DEBUG`
As last step in the removal of the dependency on Google Closure Library, the `goog.DEBUG` compiler define was renamed to `ol.DEBUG`. Please change accordingly in your custom build configuration json files.
#### `ol.format.ogc.filter` namespace was renamed to `ol.format.filter`
`ol.format.ogc.filter` was simplified to `ol.format.filter`; to upgrade your code, simply remove the `ogc` string from the name.
For example: `ol.format.ogc.filter.and` to `ol.format.filter.and`.
#### Changes only relevant to those who compile their applications together with the Closure Compiler
A number of internal types have been renamed. This will not affect those who use the API provided by the library, but if you are compiling your application together with OpenLayers and using type names, you'll need to do the following:
* rename `ol.CollectionProperty` to `ol.Collection.Property`
* rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property`
* rename `ol.DragBoxEvent` to `ol.interaction.DragBox.Event`
* rename `ol.DragBoxEventType` to `ol.interaction.DragBox.EventType`
* rename `ol.GeolocationProperty` to `ol.Geolocation.Property`
* rename `ol.OverlayPositioning` to `ol.Overlay.Positioning`
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
* rename `ol.control.MousePositionProperty` to `ol.control.MousePosition.Property`
* rename `ol.format.IGCZ` to `ol.format.IGC.Z`
* rename `ol.interaction.InteractionProperty` to `ol.interaction.Interaction.Property`
* rename `ol.interaction.DrawMode` to `ol.interaction.Draw.Mode`
* rename `ol.interaction.DrawEvent` to `ol.interaction.Draw.Event`
* rename `ol.interaction.DrawEventType` to `ol.interaction.Draw.EventType`
* rename `ol.interaction.ExtentEvent` to `ol.interaction.Extent.Event`
* rename `ol.interaction.ExtentEventType` to `ol.interaction.Extent.EventType`
* rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event`
* rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType`
* rename `ol.interaction.ModifyEvent` to `ol.interaction.Modify.Event`
* rename `ol.interaction.SelectEvent` to `ol.interaction.Select.Event`
* rename `ol.interaction.SelectEventType` to `ol.interaction.Select.EventType`
* rename `ol.interaction.TranslateEvent` to `ol.interaction.Translate.Event`
* rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType`
* rename `ol.layer.GroupProperty` to `ol.layer.Group.Property`
* rename `ol.layer.HeatmapLayerProperty` to `ol.layer.Heatmap.Property`
* rename `ol.layer.TileProperty` to `ol.layer.Tile.Property`
* rename `ol.layer.VectorTileRenderType` to `ol.layer.VectorTile.RenderType`
* rename `ol.MapEventType` to `ol.MapEvent.Type`
* rename `ol.MapProperty` to `ol.Map.Property`
* rename `ol.ModifyEventType` to `ol.interaction.Modify.EventType`
* rename `ol.RendererType` to `ol.renderer.Type`
* rename `ol.render.EventType` to `ol.render.Event.Type`
* rename `ol.source.ImageEvent` to `ol.source.Image.Event`
* rename `ol.source.ImageEventType` to `ol.source.Image.EventType`
* rename `ol.source.RasterEvent` to `ol.source.Raster.Event`
* rename `ol.source.RasterEventType` to `ol.source.Raster.EventType`
* rename `ol.source.TileEvent` to `ol.source.Tile.Event`
* rename `ol.source.TileEventType` to `ol.source.Tile.EventType`
* rename `ol.source.VectorEvent` to `ol.source.Vector.Event`
* rename `ol.source.VectorEventType` to `ol.source.Vector.EventType`
* rename `ol.source.wms.ServerType` to `ol.source.WMSServerType`
* rename `ol.source.WMTSRequestEncoding` to `ol.source.WMTS.RequestEncoding`
* rename `ol.style.IconAnchorUnits` to `ol.style.Icon.AnchorUnits`
* rename `ol.style.IconOrigin` to `ol.style.Icon.Origin`
## Full list of changes
* [#6007](https://github.com/openlayers/ol3/pull/6007) - Add note to example that canvas.toBlob() is required ([@marcjansen](https://github.com/marcjansen))
* [#5979](https://github.com/openlayers/ol3/pull/5979) - Use FileSaver.js in export-map example ([@fredj](https://github.com/fredj))
* [#6004](https://github.com/openlayers/ol3/pull/6004) - Bring back the vector-osm example, using a different service ([@ahocevar](https://github.com/ahocevar))
* [#6002](https://github.com/openlayers/ol3/pull/6002) - Use tile pixel ratio for gutter calculation ([@ahocevar](https://github.com/ahocevar))
* [#5991](https://github.com/openlayers/ol3/pull/5991) - Only test ol.format.MVT if ArrayBuffer.isView is supported ([@openlayers](https://github.com/openlayers))
* [#6000](https://github.com/openlayers/ol3/pull/6000) - Fix mockup of tile layer to keep drawImage arguments in range ([@ahocevar](https://github.com/ahocevar))
* [#5997](https://github.com/openlayers/ol3/pull/5997) - Always load a gated URL polyfill when testing ([@marcjansen](https://github.com/marcjansen))
* [#5963](https://github.com/openlayers/ol3/pull/5963) - Remove the vertex on ol.interaction.Modify deactivation ([@fredj](https://github.com/fredj))
* [#5994](https://github.com/openlayers/ol3/pull/5994) - Setup a loaded image with src for TileLayer test ([@marcjansen](https://github.com/marcjansen))
* [#5989](https://github.com/openlayers/ol3/pull/5989) - Remove vector-osm example ([@openlayers](https://github.com/openlayers))
* [#5985](https://github.com/openlayers/ol3/pull/5985) - Update Mapzen urls to new scheme ([@ahocevar](https://github.com/ahocevar))
* [#5984](https://github.com/openlayers/ol3/pull/5984) - Less examples with mixed content ([@ahocevar](https://github.com/ahocevar))
* [#5986](https://github.com/openlayers/ol3/pull/5986) - Update eslint to version 3.8.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5982](https://github.com/openlayers/ol3/pull/5982) - Use a https enabled GeoServer ([@ahocevar](https://github.com/ahocevar))
* [#5977](https://github.com/openlayers/ol3/pull/5977) - Convenience function for drawing boxes ([@tschaub](https://github.com/tschaub))
* [#5978](https://github.com/openlayers/ol3/pull/5978) - Update async to version 2.1.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#5975](https://github.com/openlayers/ol3/pull/5975) - Finish drawing on pointerup when in freehand mode ([@tschaub](https://github.com/tschaub))
* [#5976](https://github.com/openlayers/ol3/pull/5976) - Use https where available ([@tschaub](https://github.com/tschaub))
* [#5973](https://github.com/openlayers/ol3/pull/5973) - Add a freehand option to the draw interaction ([@tschaub](https://github.com/tschaub))
* [#5964](https://github.com/openlayers/ol3/pull/5964) - Set one-off transform instead of transforming back and forth ([@ahocevar](https://github.com/ahocevar))
* [#5970](https://github.com/openlayers/ol3/pull/5970) - Allow circles, squares, and boxes to be drawn in freehand mode ([@tschaub](https://github.com/tschaub))
* [#5972](https://github.com/openlayers/ol3/pull/5972) - Update eslint to version 3.8.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5969](https://github.com/openlayers/ol3/pull/5969) - Test all, not just one ([@ahocevar](https://github.com/ahocevar))
* [#5967](https://github.com/openlayers/ol3/pull/5967) - Add missing jsdoc to ol.render.canvas.Replay#fill_ function ([@fredj](https://github.com/fredj))
* [#5962](https://github.com/openlayers/ol3/pull/5962) - Use same proj4js version in examples and tests ([@ahocevar](https://github.com/ahocevar))
* [#5961](https://github.com/openlayers/ol3/pull/5961) - Remove unused error codes ([@ahocevar](https://github.com/ahocevar))
* [#5960](https://github.com/openlayers/ol3/pull/5960) - More renaming to have one provide per file ([@fredj](https://github.com/fredj))
* [#5959](https://github.com/openlayers/ol3/pull/5959) - Remove unnecessary and misleading assertion ([@ahocevar](https://github.com/ahocevar))
* [#5950](https://github.com/openlayers/ol3/pull/5950) - Move gradient and pattern fills with the view ([@ahocevar](https://github.com/ahocevar))
* [#5957](https://github.com/openlayers/ol3/pull/5957) - Update async to version 2.1.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5956](https://github.com/openlayers/ol3/pull/5956) - Update async to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5955](https://github.com/openlayers/ol3/pull/5955) - Add getters to BingMaps source for api key and imagerySet ([@bartvde](https://github.com/bartvde))
* [#5944](https://github.com/openlayers/ol3/pull/5944) - Allow readFeature and readFeatures to be called with GeoJSON geometries ([@tschaub](https://github.com/tschaub))
* [#5949](https://github.com/openlayers/ol3/pull/5949) - Add prose documentation for ol.AttributionLike ([@marcjansen](https://github.com/marcjansen))
* [#5948](https://github.com/openlayers/ol3/pull/5948) - Fix API docs of ol.Feature#getStyle ([@marcjansen](https://github.com/marcjansen))
* [#5946](https://github.com/openlayers/ol3/pull/5946) - Update mocha to version 3.1.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#5941](https://github.com/openlayers/ol3/pull/5941) - Update mocha to version 3.1.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5890](https://github.com/openlayers/ol3/pull/5890) - No gaps between tiles of different resolutions ([@ahocevar](https://github.com/ahocevar))
* [#5935](https://github.com/openlayers/ol3/pull/5935) - Keep transformed coordinates within valid y range ([@tschaub](https://github.com/tschaub))
* [#5937](https://github.com/openlayers/ol3/pull/5937) - One provide per file for vector tiles ([@ahocevar](https://github.com/ahocevar))
* [#5933](https://github.com/openlayers/ol3/pull/5933) - Update phantomjs-prebuilt to version 2.1.13 🚀 ([@openlayers](https://github.com/openlayers))
* [#5932](https://github.com/openlayers/ol3/pull/5932) - Update eslint to version 3.7.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5931](https://github.com/openlayers/ol3/pull/5931) - Update jsdoc to version 3.4.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#5923](https://github.com/openlayers/ol3/pull/5923) - Update pbf to version 3.0.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#5926](https://github.com/openlayers/ol3/pull/5926) - Ensure correct type of event.element ([@adube](https://github.com/adube))
* [#5928](https://github.com/openlayers/ol3/pull/5928) - Update eslint to version 3.7.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5919](https://github.com/openlayers/ol3/pull/5919) - Update resemblejs to version 2.2.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#5909](https://github.com/openlayers/ol3/pull/5909) - Update jquery to version 3.1.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5917](https://github.com/openlayers/ol3/pull/5917) - Accept feature projection in GeoJSON constructor ([@tschaub](https://github.com/tschaub))
* [#5918](https://github.com/openlayers/ol3/pull/5918) - Update mocha to version 3.1.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5916](https://github.com/openlayers/ol3/pull/5916) - Update eslint to version 3.6.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5914](https://github.com/openlayers/ol3/pull/5914) - Allow clipping by MultiPolygon ([@tschaub](https://github.com/tschaub))
* [#5894](https://github.com/openlayers/ol3/pull/5894) - Reuse arrays for rendered tiles and extent ([@ahocevar](https://github.com/ahocevar))
* [#5895](https://github.com/openlayers/ol3/pull/5895) - Always use the frameState's extent ([@ahocevar](https://github.com/ahocevar))
* [#5911](https://github.com/openlayers/ol3/pull/5911) - Update eslint to version 3.6.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5903](https://github.com/openlayers/ol3/pull/5903) - Rename ol.format.ogc.filter namespace to ol.format.filter ([@fredj](https://github.com/fredj))
* [#5913](https://github.com/openlayers/ol3/pull/5913) - Update clean-css to version 3.4.20 🚀 ([@openlayers](https://github.com/openlayers))
* [#5776](https://github.com/openlayers/ol3/pull/5776) - Add ol.style.Circle#setRadius ([@jonataswalker](https://github.com/jonataswalker))
* [#5905](https://github.com/openlayers/ol3/pull/5905) - Update pbf to version 3.0.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5904](https://github.com/openlayers/ol3/pull/5904) - Fix changelog/upgrade-notes.md formating ([@fredj](https://github.com/fredj))
* [#5906](https://github.com/openlayers/ol3/pull/5906) - Update glob to version 7.1.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5898](https://github.com/openlayers/ol3/pull/5898) - Update sinon to version 1.17.6 🚀 ([@openlayers](https://github.com/openlayers))
* [#5888](https://github.com/openlayers/ol3/pull/5888) - Remove unused functions ([@fredj](https://github.com/fredj))
* [#5900](https://github.com/openlayers/ol3/pull/5900) - Update coveralls to version 2.11.14 🚀 ([@openlayers](https://github.com/openlayers))
* [#5897](https://github.com/openlayers/ol3/pull/5897) - Show NEXRAD data in WMS Time example ([@ahocevar](https://github.com/ahocevar))
* [#5896](https://github.com/openlayers/ol3/pull/5896) - Remove plain string from Map renderer option ([@probins](https://github.com/probins))
* [#5893](https://github.com/openlayers/ol3/pull/5893) - Fix fillStyle or strokeStyle defined assertion ([@ahocevar](https://github.com/ahocevar))
* [#5892](https://github.com/openlayers/ol3/pull/5892) - Remove getRendererFromQueryString from examples ([@probins](https://github.com/probins))
* [#5889](https://github.com/openlayers/ol3/pull/5889) - Update coveralls to version 2.11.13 🚀 ([@openlayers](https://github.com/openlayers))
* [#5886](https://github.com/openlayers/ol3/pull/5886) - Remove unused functions ([@fredj](https://github.com/fredj))
* [#5885](https://github.com/openlayers/ol3/pull/5885) - Remove unused pruneTileRange function ([@bartvde](https://github.com/bartvde))
* [#5853](https://github.com/openlayers/ol3/pull/5853) - Allow more than one digit range in ol.TileUrlFunction.expandUrl ([@fredj](https://github.com/fredj))
* [#5445](https://github.com/openlayers/ol3/pull/5445) - Select interaction default styling function can now handle geometry less features ([@fblackburn](https://github.com/fblackburn))
* [#5884](https://github.com/openlayers/ol3/pull/5884) - Fix jsdoc tag indentation ([@fredj](https://github.com/fredj))
* [#5863](https://github.com/openlayers/ol3/pull/5863) - Allow CanvasPattern or CanvasGradient as stroke style ([@fredj](https://github.com/fredj))
* [#5838](https://github.com/openlayers/ol3/pull/5838) - Require ol where ol.DEBUG is being used ([@marcjansen](https://github.com/marcjansen))
* [#5878](https://github.com/openlayers/ol3/pull/5878) - Smarter handling of closed rings and closePath() instructions ([@ahocevar](https://github.com/ahocevar))
* [#5880](https://github.com/openlayers/ol3/pull/5880) - More work towards one provide per file ([@marcjansen](https://github.com/marcjansen))
* [#5857](https://github.com/openlayers/ol3/pull/5857) - Fixed issue with multi option of ol.interaction.Select ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#5876](https://github.com/openlayers/ol3/pull/5876) - Use clone method in kml format ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#5832](https://github.com/openlayers/ol3/pull/5832) - Add clone methods to styles ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#5869](https://github.com/openlayers/ol3/pull/5869) - Update jsdoc to version 3.4.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#5872](https://github.com/openlayers/ol3/pull/5872) - Keep ol.Color as Array<number> ([@tschaub](https://github.com/tschaub))
* [#5870](https://github.com/openlayers/ol3/pull/5870) - Update eslint to version 3.5.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5867](https://github.com/openlayers/ol3/pull/5867) - Add dedicated example using CanvasPattern and CanvasGradient for styling vectors ([@marcjansen](https://github.com/marcjansen))
* [#5864](https://github.com/openlayers/ol3/pull/5864) - More renaming ([@fredj](https://github.com/fredj))
* [#5861](https://github.com/openlayers/ol3/pull/5861) - More renaming to have one provide per file ([@fredj](https://github.com/fredj))
* [#5860](https://github.com/openlayers/ol3/pull/5860) - Rename ol.MapProperty and ol.interaction.DragAndDropEvent* ([@fredj](https://github.com/fredj))
* [#5855](https://github.com/openlayers/ol3/pull/5855) - Rename ol.DragBoxEvent* to ol.interaction.DragBox.Event* ([@fredj](https://github.com/fredj))
* [#5859](https://github.com/openlayers/ol3/pull/5859) - Rename ol.RendererType to ol.renderer.Type ([@fredj](https://github.com/fredj))
* [#5846](https://github.com/openlayers/ol3/pull/5846) - Remove unused goog.require('ol') ([@probins](https://github.com/probins))
* [#5854](https://github.com/openlayers/ol3/pull/5854) - Use a canvas pattern in the vector-layer example ([@fredj](https://github.com/fredj))
* [#5852](https://github.com/openlayers/ol3/pull/5852) - ol.interaction.extent cleanup ([@fredj](https://github.com/fredj))
* [#5851](https://github.com/openlayers/ol3/pull/5851) - Remove unused imageByContext_ in ol.ImageTile ([@fredj](https://github.com/fredj))
* [#5849](https://github.com/openlayers/ol3/pull/5849) - Remove 'global' from externs/closure-compiler.js ([@fredj](https://github.com/fredj))
* [#5837](https://github.com/openlayers/ol3/pull/5837) - Remove ol.global ([@tschaub](https://github.com/tschaub))
* [#5842](https://github.com/openlayers/ol3/pull/5842) - Remove extra provide causing a circular dependency ([@ahocevar](https://github.com/ahocevar))
* [#5795](https://github.com/openlayers/ol3/pull/5795) - Render older loaded tiles while waiting for new tiles ([@thomasmoelhave](https://github.com/thomasmoelhave))
* [#5840](https://github.com/openlayers/ol3/pull/5840) - Rename source.wms.ServerType ➛ source.WMSServerType ([@marcjansen](https://github.com/marcjansen))
* [#5839](https://github.com/openlayers/ol3/pull/5839) - Rename source.VectorEvent(*) to source.Vector.Event(*) ([@marcjansen](https://github.com/marcjansen))
* [#5835](https://github.com/openlayers/ol3/pull/5835) - document and test ol.getUid sequence behavior ([@thomasmoelhave](https://github.com/thomasmoelhave))
* [#5834](https://github.com/openlayers/ol3/pull/5834) - Rename goog.DEBUG to ol.DEBUG ([@thomasmoelhave](https://github.com/thomasmoelhave))
* [#5815](https://github.com/openlayers/ol3/pull/5815) - Remove the DOM renderer ([@tschaub](https://github.com/tschaub))
* [#5828](https://github.com/openlayers/ol3/pull/5828) - Always close polygon rings ([@ahocevar](https://github.com/ahocevar))
* [#5794](https://github.com/openlayers/ol3/pull/5794) - Fix more missing requires ([@openlayers](https://github.com/openlayers))
* [#5820](https://github.com/openlayers/ol3/pull/5820) - Change ol.format.Format to ol.format.Feature in format/readme.md ([@fredj](https://github.com/fredj))
* [#5819](https://github.com/openlayers/ol3/pull/5819) - Add ArrayBuffer.isView method in externs/closure-compiler.js ([@fredj](https://github.com/fredj))
* [#5793](https://github.com/openlayers/ol3/pull/5793) - Closure bye bye ([@ahocevar](https://github.com/ahocevar))
* [#5809](https://github.com/openlayers/ol3/pull/5809) - Reuse ol.LayerState object ([@fredj](https://github.com/fredj))
* [#5811](https://github.com/openlayers/ol3/pull/5811) - Use ol.global.getComputedStyle instead of window.getComputedStyle ([@fredj](https://github.com/fredj))
* [#5810](https://github.com/openlayers/ol3/pull/5810) - ESLint rule typo ([@gberaudo](https://github.com/gberaudo))
* [#5807](https://github.com/openlayers/ol3/pull/5807) - Update pbf to version 3.0.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5806](https://github.com/openlayers/ol3/pull/5806) - Fix olx.style.TextOptions.rotateWithView option in externs ([@fredj](https://github.com/fredj))
* [#5770](https://github.com/openlayers/ol3/pull/5770) - Update ol.source.Vector comments ([@fredj](https://github.com/fredj))
* [#5803](https://github.com/openlayers/ol3/pull/5803) - V3.18.1 ([@openlayers](https://github.com/openlayers))
* [#5801](https://github.com/openlayers/ol3/pull/5801) - Remove ol.style.ImageState and use ol.ImageState instead ([@fredj](https://github.com/fredj))
* [#5790](https://github.com/openlayers/ol3/pull/5790) - Fix vector tile rotation on HiDPI devices ([@ahocevar](https://github.com/ahocevar))
* [#5798](https://github.com/openlayers/ol3/pull/5798) - Move to 90° along the circle, not 0° ([@ahocevar](https://github.com/ahocevar))
* [#5800](https://github.com/openlayers/ol3/pull/5800) - Wrap values in <Literal> for InBetween filter ([@tsauerwein](https://github.com/tsauerwein))
* [#5769](https://github.com/openlayers/ol3/pull/5769) - Only call addToDrawing if sketchFeature ([@bartvde](https://github.com/bartvde))
* [#5745](https://github.com/openlayers/ol3/pull/5745) - removed dependencies on goog.object.clone and fixed placemark rendering ([@tamarmot](https://github.com/tamarmot))
* [#5290](https://github.com/openlayers/ol3/pull/5290) - Add extent interaction ([@tbarsballe](https://github.com/tbarsballe))
* [#5786](https://github.com/openlayers/ol3/pull/5786) - Update eslint to version 3.4.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5785](https://github.com/openlayers/ol3/pull/5785) - Release v3.18.0 ([@openlayers](https://github.com/openlayers))

View File

@@ -1,22 +0,0 @@
# v3.19.1
## Summary
The v3.19.1 release is a patch release that addresses four regressions in the
v3.19.0 release. See the
[v3.19.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.19.0)
for details on upgrading from v3.18.x.
## Upgrade notes
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
The origin for gradients and patterns has changed from `[0, 0]` to the top-left
corner of the extent of the geometry being filled.
## Fixes
* [#6039](https://github.com/openlayers/ol3/pull/6039) - Do not fill when there is no fillStyle ([@ahocevar](https://github.com/ahocevar))
* [#6034](https://github.com/openlayers/ol3/pull/6034) - Use geometry extent's top left corner as pattern/gradient origin ([@ahocevar](https://github.com/ahocevar))
* [#6027](https://github.com/openlayers/ol3/pull/6027) - Close polygon sketch at all times ([@bjornharrtell](https://github.com/bjornharrtell))
* [#6022](https://github.com/openlayers/ol3/pull/6022) - Revert "Merge pull request #5890 from ahocevar/no-white-lines" ([@ahocevar](https://github.com/ahocevar))

View File

@@ -2,7 +2,7 @@
## Summary
The 3.1.0 release includes 70 merged pull requests since 3.1.0. Of note, the KML format [now parses `NetworkingLink` tags](https://github.com/openlayers/ol3/pull/3171). The [measure example](https://openlayers.org/en/v3.2.0/examples/measure.html) was [reworked](https://github.com/openlayers/ol3/pull/3206) to display measurements and help messages while drawing. A WMTS GetCapabilities format was [added](https://github.com/openlayers/ol3/pull/3026). The WebGL renderer [now supports feature hit detection](https://github.com/openlayers/ol3/pull/3065) (on point features). And you can now [detect](https://github.com/openlayers/ol3/pull/3172) features/colored pixels on image and tile layers! See the full list of [changes](#changes) below.
The 3.1.0 release includes 70 merged pull requests since 3.1.0. Of note, the KML format [now parses `NetworkingLink` tags](https://github.com/openlayers/ol3/pull/3171). The [measure example](http://openlayers.org/en/v3.2.0/examples/measure.html) was [reworked](https://github.com/openlayers/ol3/pull/3206) to display measurements and help messages while drawing. A WMTS GetCapabilities format was [added](https://github.com/openlayers/ol3/pull/3026). The WebGL renderer [now supports feature hit detection](https://github.com/openlayers/ol3/pull/3065) (on point features). And you can now [detect](https://github.com/openlayers/ol3/pull/3172) features/colored pixels on image and tile layers! See the full list of [changes](#changes) below.
## Upgrade notes

View File

@@ -53,7 +53,7 @@ The 3.5.0 release includes features and fixes from a whopping 129 pull requests
});
```
See https://openlayers.org/en/master/examples/vector-layer.html for a real example.
See http://openlayers.org/en/master/examples/vector-layer.html for a real example.
Note that you no longer need to set a `projection` on the source!
@@ -75,7 +75,7 @@ The 3.5.0 release includes features and fixes from a whopping 129 pull requests
The above code uses jQuery to send an Ajax request, but you can obviously use any Ajax library.
See https://openlayers.org/en/master/examples/igc.html for a real example.
See http://openlayers.org/en/master/examples/igc.html for a real example.
* Note about KML
@@ -133,9 +133,9 @@ The 3.5.0 release includes features and fixes from a whopping 129 pull requests
});
```
See https://openlayers.org/en/master/examples/vector-osm.html for a real example.
See http://openlayers.org/en/master/examples/vector-osm.html for a real example.
* The experimental `ol.loadingstrategy.createTile` function has been renamed to `ol.loadingstrategy.tile`. The signature of the function hasn't changed. See https://openlayers.org/en/master/examples/vector-osm.html for an example.
* The experimental `ol.loadingstrategy.createTile` function has been renamed to `ol.loadingstrategy.tile`. The signature of the function hasn't changed. See http://openlayers.org/en/master/examples/vector-osm.html for an example.
### Change to `ol.style.Icon`

View File

@@ -66,16 +66,16 @@
<textarea class="hidden" name="css">{{ css.source }}</textarea>
<textarea class="hidden" name="html">{{ contents }}</textarea>
<input type="hidden" name="wrap" value="l">
<input type="hidden" name="resources" value="https://openlayers.org/en/v{{ olVersion }}/css/ol.css,https://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}">
<input type="hidden" name="resources" value="http://openlayers.org/en/v{{ olVersion }}/css/ol.css,http://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}">
</form>
<pre><code id="example-source" class="language-markup">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;{{ title }}&lt;/title&gt;
&lt;link rel="stylesheet" href="https://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css"&gt;
&lt;link rel="stylesheet" href="http://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css"&gt;
&lt;!-- The line below is only needed for old environments like Internet Explorer and Android 4.x --&gt;
&lt;script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"&gt;&lt;/script&gt;
&lt;script src="https://openlayers.org/en/v{{ olVersion }}/build/ol.js"&gt;&lt;/script&gt;{{#if extraHead.remote}}
&lt;script src="http://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"&gt;&lt;/script&gt;
&lt;script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"&gt;&lt;/script&gt;{{#if extraHead.remote}}
{{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}}
&lt;style&gt;
{{ indent css.source spaces=6 }} &lt;/style&gt;{{/if}}

View File

@@ -15,11 +15,11 @@
</tr><tr>
<th>Controls</th><th>Interactions</th><th>Sources and formats</th>
</tr><tr>
<td>[Map default controls](ol.control.html#.defaults)<br>
<td>[Map default controls](ol.control.html#defaults)<br>
[All controls](ol.control.html)
</td>
<td>
[Map default interactions](ol.interaction.html#.defaults)<br>
[Map default interactions](ol.interaction.html#defaults)<br>
Interactions for [vector features](ol.Feature.html)
<ul><li>[ol.interaction.Select](ol.interaction.Select.html)</li>
<li>[ol.interaction.Draw](ol.interaction.Draw.html)</li>
@@ -32,7 +32,7 @@ Interactions for [vector features](ol.Feature.html)
<br>[Formats](ol.format.Feature.html) for reading/writing vector data
<br>[ol.format.WMSCapabilities](ol.format.WMSCapabilities.html)</td></tr>
<tr><th>Projections</th><th>Observable objects</th><th>Other components</th></tr>
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol.proj.transform()](ol.proj.html#.transform) and [ol.proj.transformExtent()](ol.proj.html#.transformExtent).</p>
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol.proj.transform()](ol.proj.html#transform) and [ol.proj.transformExtent()](ol.proj.html#transformExtent).</p>
[ol.proj](ol.proj.html)</td>
<td><p>Changes to all [ol.Objects](ol.Object.html) can observed by calling the [object.on('propertychange')](ol.Object.html#on) method. Listeners receive an [ol.ObjectEvent](ol.ObjectEvent.html) with information on the changed property and old value.</p>
<td>[ol.DeviceOrientation](ol.DeviceOrientation.html)<br>

View File

@@ -137,6 +137,10 @@ Invalid `units`. `'degrees'`, `'imperial'`, `'nautical'`, `'metric'` or `'us'` r
Invalid geometry layout. Must be `XY`, `XYZ`, `XYM` or `XYZM`.
### 35
Unknown GeoJSON object type. Expected `"Feature"` or `"FeatureCollection"`.
### 36
Unknown SRS type. Expected `"name"` or `"EPSG"`.
@@ -161,6 +165,10 @@ Expected `feature` to have a geometry.
Expected an `ol.style.Style` or an array of `ol.style.Style`.
### 42
Expected an `ol.Feature`, but got an `ol.RenderFeature`.
### 43
Expected `layers` to be an array or an `ol.Collection`.

View File

@@ -77,7 +77,7 @@ var map = new ol.Map({
var swissProjection = new ol.proj.Projection({
code: 'EPSG:21781',
// The extent is used to determine zoom level 0. Recommended values for a
// projection's validity extent can be found at https://epsg.io/.
// projection's validity extent can be found at http://epsg.io/.
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864],
units: 'm'
});
@@ -94,7 +94,7 @@ var map = new ol.Map({
```
We recommend to lookup parameters of your projection (like the validity extent)
over at [epsg.io](https://epsg.io/).
over at [epsg.io](http://epsg.io/).
## Why is my map centered on the gulf of guinea (or africa, the ocean, null-island)?

View File

@@ -9,7 +9,7 @@ If you're eager to get your first OpenLayers 3 map on a page, dive into the [qui
For a more in-depth overview of OpenLayers 3 core concepts, check out the [tutorials](tutorials/).
Make sure to also check out the [OpenLayers 3 workshop](/workshop/).
Make sure to also check out the [OpenLayers 3 workshop](/workshop/en/).
Find additional reference material in the [API docs](../apidoc).

View File

@@ -13,14 +13,14 @@ Below you'll find a complete working example. Create a new file, copy in the co
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://openlayers.org/en/{{ latest }}/css/ol.css" type="text/css">
<link rel="stylesheet" href="http://openlayers.org/en/{{ latest }}/css/ol.css" type="text/css">
<style>
.map {
height: 400px;
width: 100%;
}
</style>
<script src="https://openlayers.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
<script src="http://openlayers.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
<title>OpenLayers 3 example</title>
</head>
<body>
@@ -55,7 +55,7 @@ To include a map a web page you will need 3 things:
### Include OpenLayers
```xml
<script src="https://openlayers.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
<script src="http://openlayers.org/en/{{ latest }}/build/ol.js" type="text/javascript"></script>
```
The first part is to include the JavaScript library. For the purpose of this tutorial, here we simply point to the openlayers.org website to get the whole library. In a production environment, we would build a custom version of the library including only the module needed for our application.
@@ -63,7 +63,7 @@ The first part is to include the JavaScript library. For the purpose of this tut
**Optional:** If the application is intended to run on old platforms like Internet Explorer or Android 4.x, another script needs to be included before OpenLayers:
```xml
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList"></script>
<script src="http://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList"></script>
```

View File

@@ -95,7 +95,7 @@ var map = new ol.Map({
});
```
Note that this JavaScript code corresponds to OpenLayers 3's [`simple`](https://openlayers.org/en/master/examples/simple.html) example.
Note that this JavaScript code corresponds to OpenLayers 3's [`simple`](http://openlayers.org/en/master/examples/simple.html) example.
You are now ready to create your first OpenLayers 3 build. Use the following command to create the build:
@@ -180,7 +180,7 @@ Note that `build.js` currently requires you to enter an output file and will wri
## A more complicated example
Now let's try a more complicated example: [`heatmaps-earthquakes`](https://openlayers.org/en/master/examples/heatmap-earthquakes.html). The build configuration file looks like this:
Now let's try a more complicated example: [`heatmaps-earthquakes`](http://openlayers.org/en/master/examples/heatmap-earthquakes.html). The build configuration file looks like this:
```json
{

View File

@@ -34,7 +34,7 @@ The library is intended for use on both desktop/laptop and mobile devices.
OL3 uses a similar object hierarchy to the Closure library. There is a top-level `ol` namespace (basically, `var ol = {};`). Subdivisions of this are:
* further namespaces, such as `ol.layer`; these have a lower-case initial
* simple objects containing static properties and methods, such as `ol.easing`; these also have a lower-case initial
* simple objects containing static properties and methods, such as `ol.animation`; these also have a lower-case initial
* types, which have an upper-case initial. These are mainly 'classes', which here means a constructor function with prototypal inheritance, such as `ol.Map` or `ol.layer.Vector` (the Vector class within the layer namespace). There are however other, simpler, types, such as `ol.Extent`, which is an array.
Class namespaces, such as `ol.layer` have a base class type with the same name, such as `ol.layer.Layer`. These are mainly abstract classes, from which the other subclasses inherit.

View File

@@ -10,7 +10,7 @@ Transformation of the map projections of the image happens directly in a web bro
The view in any Proj4js supported coordinate reference system is possible and previously incompatible layers can now be combined and overlaid.
# Usage
The API usage is very simple. Just specify proper projection (using [EPSG](https://epsg.io) code) on `ol.View`:
The API usage is very simple. Just specify proper projection (using [EPSG](http://epsg.io) code) on `ol.View`:
``` javascript
var map = new ol.Map({
target: 'map',
@@ -35,14 +35,14 @@ var map = new ol.Map({
If a source (based on `ol.source.TileImage` or `ol.source.Image`) has a projection different from the current `ol.View`s projection then the reprojection happens automatically under the hood.
### Examples
- [Raster reprojection demo](https://openlayers.org/en/master/examples/reprojection.html)
- [OpenStreetMap to WGS84 reprojection](https://openlayers.org/en/master/examples/reprojection-wgs84.html)
- [Reprojection with EPSG.io database search](https://openlayers.org/en/master/examples/reprojection-by-code.html)
- [Image reprojection](https://openlayers.org/en/master/examples/reprojection-image.html)
- [Raster reprojection demo](http://openlayers.org/en/master/examples/reprojection.html)
- [OpenStreetMap to WGS84 reprojection](http://openlayers.org/en/master/examples/reprojection-wgs84.html)
- [Reprojection with EPSG.io database search](http://openlayers.org/en/master/examples/reprojection-by-code.html)
- [Image reprojection](http://openlayers.org/en/master/examples/reprojection-image.html)
### Custom projection
The easiest way to use a custom projection is to add the [Proj4js](http://proj4js.org/) library to your project and then define the projection using a proj4 definition string.
Following example shows definition of a [British National Grid](https://epsg.io/27700):
Following example shows definition of a [British National Grid](http://epsg.io/27700):
``` html
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js"></script>
@@ -122,7 +122,7 @@ Although this is mathematically correct behavior of the inverse transformation,
A possible general solution would be to calculate the forward transformation for every vertex as well - but this would significantly decrease performance (especially for computationally expensive transformations).
Therefore a recommended workaround is to define a proper visibility extent on the `ol.layer.Tile` in the view projection.
Setting such a limit is demonstrated in the [reprojection demo example](https://openlayers.org/en/master/examples/reprojection.html).
Setting such a limit is demonstrated in the [reprojection demo example](http://openlayers.org/en/master/examples/reprojection.html).
### Resolution calculation
When determining source tiles to load, the ideal source resolution needs to be calculated.

View File

@@ -7,7 +7,6 @@
"d3": false,
"jsPDF": false,
"jsts": false,
"saveAs": false,
"topojson": false,
"turf": false
},

View File

@@ -3,17 +3,17 @@ layout: example.html
title: View Animation
shortdesc: Demonstrates animated pan, zoom, and rotation.
docs: >
This example shows how to use the <code>view.animate()</code> method to run
one or more animations.
This example shows how to use the beforeRender function on the Map to run one
or more animations.
tags: "animation"
---
<div id="map" class="map"></div>
<button id="rotate-left" title="Rotate clockwise"></button>
<button id="rotate-right" title="Rotate counterclockwise"></button>
<button id="rotate-around-rome">Rotate around Rome</button>
<button id="pan-to-london">Pan to London</button>
<button id="elastic-to-moscow">Elastic to Moscow</button>
<button id="bounce-to-istanbul">Bounce to Istanbul</button>
<button id="spin-to-rome">Spin to Rome</button>
<button id="fly-to-bern">Fly to Bern</button>
<button id="rotate-around-rome">Rotate around Rome</button>
<button id="tour">Take a tour</button>
<button id="spiral-to-madrid">Spiral to Madrid</button>

View File

@@ -1,35 +1,13 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.animation');
goog.require('ol.control');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM');
var london = ol.proj.fromLonLat([-0.12755, 51.507222]);
var moscow = ol.proj.fromLonLat([37.6178, 55.7517]);
var istanbul = ol.proj.fromLonLat([28.9744, 41.0128]);
var rome = ol.proj.fromLonLat([12.5, 41.9]);
var bern = ol.proj.fromLonLat([7.4458, 46.95]);
var view = new ol.View({
center: istanbul,
zoom: 6
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
preload: 4,
source: new ol.source.OSM()
})
],
// Improve user experience by loading tiles while animating. Will make
// animations stutter on mobile or slow devices.
loadTilesWhileAnimating: true,
view: view
});
// A bounce easing method (from https://github.com/DmitryBaranovskiy/raphael).
// from https://github.com/DmitryBaranovskiy/raphael
function bounce(t) {
var s = 7.5625, p = 2.75, l;
if (t < (1 / p)) {
@@ -51,116 +29,159 @@ function bounce(t) {
return l;
}
// An elastic easing method (from https://github.com/DmitryBaranovskiy/raphael).
// from https://github.com/DmitryBaranovskiy/raphael
function elastic(t) {
return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
}
function onClick(id, callback) {
document.getElementById(id).addEventListener('click', callback);
}
var london = ol.proj.fromLonLat([-0.12755, 51.507222]);
var moscow = ol.proj.fromLonLat([37.6178, 55.7517]);
var istanbul = ol.proj.fromLonLat([28.9744, 41.0128]);
var rome = ol.proj.fromLonLat([12.5, 41.9]);
var bern = ol.proj.fromLonLat([7.4458, 46.95]);
var madrid = ol.proj.fromLonLat([-3.683333, 40.4]);
onClick('rotate-left', function() {
view.animate({
rotation: view.getRotation() + Math.PI / 2
});
var view = new ol.View({
// the view's initial state
center: istanbul,
zoom: 6
});
onClick('rotate-right', function() {
view.animate({
rotation: view.getRotation() - Math.PI / 2
});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
preload: 4,
source: new ol.source.OSM()
})
],
// Improve user experience by loading tiles while animating. Will make
// animations stutter on mobile or slow devices.
loadTilesWhileAnimating: true,
target: 'map',
controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
collapsible: false
})
}),
view: view
});
onClick('rotate-around-rome', function() {
view.animate({
rotation: view.getRotation() + 2 * Math.PI,
anchor: rome
});
});
onClick('pan-to-london', function() {
view.animate({
center: london,
duration: 2000
});
});
onClick('elastic-to-moscow', function() {
view.animate({
center: moscow,
var rotateLeft = document.getElementById('rotate-left');
rotateLeft.addEventListener('click', function() {
var rotateLeft = ol.animation.rotate({
duration: 2000,
easing: elastic
rotation: -4 * Math.PI
});
});
onClick('bounce-to-istanbul', function() {
view.animate({
center: istanbul,
map.beforeRender(rotateLeft);
}, false);
var rotateRight = document.getElementById('rotate-right');
rotateRight.addEventListener('click', function() {
var rotateRight = ol.animation.rotate({
duration: 2000,
easing: bounce
rotation: 4 * Math.PI
});
});
map.beforeRender(rotateRight);
}, false);
onClick('spin-to-rome', function() {
view.animate({
center: rome,
rotation: 2 * Math.PI,
duration: 2000
var rotateAroundRome = document.getElementById('rotate-around-rome');
rotateAroundRome.addEventListener('click', function() {
var currentRotation = view.getRotation();
var rotateAroundRome = ol.animation.rotate({
anchor: rome,
duration: 1000,
rotation: currentRotation
});
});
map.beforeRender(rotateAroundRome);
view.rotate(currentRotation + (Math.PI / 2), rome);
}, false);
function flyTo(location, done) {
var panToLondon = document.getElementById('pan-to-london');
panToLondon.addEventListener('click', function() {
var pan = ol.animation.pan({
duration: 2000,
source: /** @type {ol.Coordinate} */ (view.getCenter())
});
map.beforeRender(pan);
view.setCenter(london);
}, false);
var elasticToMoscow = document.getElementById('elastic-to-moscow');
elasticToMoscow.addEventListener('click', function() {
var pan = ol.animation.pan({
duration: 2000,
easing: elastic,
source: /** @type {ol.Coordinate} */ (view.getCenter())
});
map.beforeRender(pan);
view.setCenter(moscow);
}, false);
var bounceToIstanbul = document.getElementById('bounce-to-istanbul');
bounceToIstanbul.addEventListener('click', function() {
var pan = ol.animation.pan({
duration: 2000,
easing: bounce,
source: /** @type {ol.Coordinate} */ (view.getCenter())
});
map.beforeRender(pan);
view.setCenter(istanbul);
}, false);
var spinToRome = document.getElementById('spin-to-rome');
spinToRome.addEventListener('click', function() {
var duration = 2000;
var zoom = view.getZoom();
var parts = 2;
var called = false;
function callback(complete) {
--parts;
if (called) {
return;
}
if (parts === 0 || !complete) {
called = true;
done(complete);
}
}
view.animate({
center: location,
duration: duration
}, callback);
view.animate({
zoom: zoom - 1,
duration: duration / 2
}, {
zoom: zoom,
duration: duration / 2
}, callback);
}
var start = +new Date();
var pan = ol.animation.pan({
duration: duration,
source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start
});
var rotate = ol.animation.rotate({
duration: duration,
rotation: 2 * Math.PI,
start: start
});
map.beforeRender(pan, rotate);
view.setCenter(rome);
}, false);
onClick('fly-to-bern', function() {
flyTo(bern, function() {});
});
var flyToBern = document.getElementById('fly-to-bern');
flyToBern.addEventListener('click', function() {
var duration = 2000;
var start = +new Date();
var pan = ol.animation.pan({
duration: duration,
source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start
});
var bounce = ol.animation.bounce({
duration: duration,
resolution: 4 * view.getResolution(),
start: start
});
map.beforeRender(pan, bounce);
view.setCenter(bern);
}, false);
function tour() {
var locations = [london, bern, rome, moscow, istanbul];
var index = -1;
function next(more) {
if (more) {
++index;
if (index < locations.length) {
var delay = index === 0 ? 0 : 750;
setTimeout(function() {
flyTo(locations[index], next);
}, delay);
} else {
alert('Tour complete');
}
} else {
alert('Tour cancelled');
}
}
next(true);
}
onClick('tour', tour);
var spiralToMadrid = document.getElementById('spiral-to-madrid');
spiralToMadrid.addEventListener('click', function() {
var duration = 2000;
var start = +new Date();
var pan = ol.animation.pan({
duration: duration,
source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start
});
var bounce = ol.animation.bounce({
duration: duration,
resolution: 2 * view.getResolution(),
start: start
});
var rotate = ol.animation.rotate({
duration: duration,
rotation: -4 * Math.PI,
start: start
});
map.beforeRender(pan, bounce, rotate);
view.setCenter(madrid);
}, false);

View File

@@ -5,7 +5,7 @@ goog.require('ol.layer.Image');
goog.require('ol.source.OSM');
goog.require('ol.source.ImageArcGISRest');
var url = 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
var url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
'Specialty/ESRI_StateCityHighway_USA/MapServer';
var layers = [

View File

@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
goog.require('ol.source.TileArcGISRest');
var url = 'https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
var url = 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/' +
'Specialty/ESRI_StateCityHighway_USA/MapServer';
var layers = [

View File

@@ -1,8 +1,6 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.format.GeoJSON');
goog.require('ol.has');
goog.require('ol.layer.Vector');
goog.require('ol.proj');
goog.require('ol.source.Vector');
@@ -10,22 +8,14 @@ goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
// Gradient and pattern are in canvas pixel space, so we adjust for the
// renderer's pixel ratio
var pixelRatio = ol.has.DEVICE_PIXEL_RATIO;
// Will contain ol.Style instances key by country.
var styleLookup = {};
// Generate a rainbow gradient
function gradient(feature, resolution) {
var extent = feature.getGeometry().getExtent();
// Gradient starts on the left edge of each feature, and ends on the right.
// Coordinate origin is the top-left corner of the extent of the geometry, so
// we just divide the geometry's extent width by resolution and multiply with
// pixelRatio to match the renderer's pixel coordinate system.
var grad = context.createLinearGradient(0, 0,
ol.extent.getWidth(extent) / resolution * pixelRatio, 0);
var gradient = (function() {
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
var grad = context.createLinearGradient(0,0,1000,0);
grad.addColorStop(0, 'red');
grad.addColorStop(1 / 6, 'orange');
grad.addColorStop(2 / 6, 'yellow');
@@ -34,35 +24,33 @@ function gradient(feature, resolution) {
grad.addColorStop(5 / 6, 'blue');
grad.addColorStop(1, 'purple');
return grad;
}
}());
// Generate a canvasPattern with two circles on white background
// Generate a canvasPattern with two circles
var pattern = (function() {
canvas.width = 11 * pixelRatio;
canvas.height = 11 * pixelRatio;
// white background
context.fillStyle = 'white';
context.fillRect(0, 0, canvas.width, canvas.height);
// outer circle
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
canvas.width = 11;
canvas.height = 11;
context.fillStyle = 'rgba(102, 0, 102, 0.5)';
context.beginPath();
context.arc(5 * pixelRatio, 5 * pixelRatio, 4 * pixelRatio, 0, 2 * Math.PI);
context.arc(5, 5, 4, 0, 2 * Math.PI);
context.fill();
// inner circle
context.fillStyle = 'rgb(55, 0, 170)';
context.beginPath();
context.arc(5 * pixelRatio, 5 * pixelRatio, 2 * pixelRatio, 0, 2 * Math.PI);
context.arc(5, 5, 2, 0, 2 * Math.PI);
context.fill();
return context.createPattern(canvas, 'repeat');
}());
// Generate style for gradient or pattern fill
var fill = new ol.style.Fill();
var style = new ol.style.Style({
fill: fill,
// Generate a background style that all features will reuse
var backgroundStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#333',
width: 2
}),
fill: new ol.style.Fill({
color: '#fff'
})
});
@@ -70,14 +58,33 @@ var style = new ol.style.Style({
* The styling function for the vector layer, will return an array of styles
* which either contains the aboove gradient or pattern.
*
* @param {ol.Feature} feature The feature to style.
* @param {number} resolution Resolution.
* @return {ol.style.Style} The style to use for the feature.
* @param {ol.Feature} feature the feature to style.
* @return {Array<ol.style.Style>} the styles to use for the feature.
*/
var getStackedStyle = function(feature, resolution) {
var getStackedStyle = function(feature) {
var id = feature.getId();
fill.setColor(id > 'J' ? gradient(feature, resolution) : pattern);
return style;
if (!styleLookup[id]) {
var patternOrGradient;
if (id > 'J') { // some shall get the gradient, others the pattern.
patternOrGradient = gradient;
} else {
patternOrGradient = pattern;
}
// Store the style in the lookup, next call will just return the stored
// style for the feature.
styleLookup[id] = [
// 1. Use the common background style
// (white fill and blackish stroke)
backgroundStyle,
// 2. On top of that, draw the pattern or gradient
new ol.style.Style({
fill: new ol.style.Fill({
color: patternOrGradient
})
})
];
}
return styleLookup[id];
};
// Create a vector layer that makes use of the style function above…

View File

@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var logoElement = document.createElement('a');
logoElement.href = 'https://www.osgeo.org/';
logoElement.href = 'http://www.osgeo.org/';
logoElement.target = '_blank';
var logoImage = document.createElement('img');

View File

@@ -2,9 +2,9 @@
<Document>
<name>Skimap.org OpenSkiMap </name>
<description>Created from OpenStreetMap data. Renderer v0.5</description>
<!--
<!--
Copyright (c) OpenStreetMap Contributors
https://www.openstreetmap.org/
http://www.openstreetmap.org/
This work is licensed under the
Creative Commons Attribution-ShareAlike 2.0 License.
@@ -13,7 +13,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<ScreenOverlay id="CopyrightNotice">
<name>Copyright Notice</name>
<description>
<![CDATA[The data in this KML file is Copyright <a href="https://www.openstreetmap.org/">OpenStreetMap</a> Contributors. It is available under the <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons Attribution-ShareAlike (CC-BY-SA) Version 2.0 License</a>.]]>
<![CDATA[The data in this KML file is Copyright <a href="http://www.openstreetmap.org/">OpenStreetMap</a> Contributors. It is available under the <a href="http://creativecommons.org/licenses/by-sa/2.0/">Creative Commons Attribution-ShareAlike (CC-BY-SA) Version 2.0 License</a>.]]>
</description>
<Snippet>Copyright (c) OpenStreetMap Contributors. CC-BY-SA 2.0 License.</Snippet>
<Icon>
@@ -32,7 +32,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<IconStyle>
<scale>0.2</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/shapes/parking_lot.png</href>
<href>http://maps.google.com/mapfiles/kml/shapes/parking_lot.png</href>
</Icon>
</IconStyle>
</Style>
@@ -140,7 +140,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<IconStyle>
<scale>0.7</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/pal2/icon21.png</href>
<href>http://maps.google.com/mapfiles/kml/pal2/icon21.png</href>
</Icon>
</IconStyle>
</Style>
@@ -170,7 +170,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<IconStyle>
<scale>0.7</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/pal2/icon30.png</href>
<href>http://maps.google.com/mapfiles/kml/pal2/icon30.png</href>
</Icon>
</IconStyle>
</Style>
@@ -188,7 +188,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<IconStyle>
<scale>0.7</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/pal2/icon28.png</href>
<href>http://maps.google.com/mapfiles/kml/pal2/icon28.png</href>
</Icon>
</IconStyle>
</Style>
@@ -325,7 +325,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<IconStyle>
<scale>0.7</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/pal2/icon40.png</href>
<href>http://maps.google.com/mapfiles/kml/pal2/icon40.png</href>
</Icon>
</IconStyle>
</Style>
@@ -548,7 +548,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<IconStyle>
<scale>0.7</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/pal3/icon38.png</href>
<href>http://maps.google.com/mapfiles/kml/pal3/icon38.png</href>
</Icon>
</IconStyle>
</Style>
@@ -559,7 +559,7 @@ http://creativecommons.org/licenses/by-sa/2.0/
<IconStyle>
<scale>0.7</scale>
<Icon>
<href>https://maps.google.com/mapfiles/kml/pal3/icon38.png</href>
<href>http://maps.google.com/mapfiles/kml/pal3/icon38.png</href>
</Icon>
</IconStyle>
</Style>

View File

@@ -5,8 +5,11 @@ shortdesc: Example of using the ol.interaction.Draw interaction.
docs: >
Example of using the Draw interaction. Select a geometry type from the
dropdown above to start drawing. To finish drawing, click the last
point. To activate freehand drawing for lines, polygons, and circles, hold
the `Shift` key.
point. To activate freehand drawing for lines and polygons, hold the `Shift`
key. Square drawing is achieved by using Circle mode with a `geometryFunction`
that creates a 4-sided regular polygon instead of a circle. Box drawing uses a
custom `geometryFunction` that takes start and end point of a line with 2
points and creates a rectangular box.
tags: "draw, edit, freehand, vector"
---
<div id="map" class="map"></div>
@@ -17,6 +20,8 @@ tags: "draw, edit, freehand, vector"
<option value="LineString">LineString</option>
<option value="Polygon">Polygon</option>
<option value="Circle">Circle</option>
<option value="Square">Square</option>
<option value="Box">Box</option>
<option value="None">None</option>
</select>
</form>

View File

@@ -1,10 +1,15 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Polygon');
goog.require('ol.interaction.Draw');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
@@ -13,7 +18,22 @@ var raster = new ol.layer.Tile({
var source = new ol.source.Vector({wrapX: false});
var vector = new ol.layer.Vector({
source: source
source: source,
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#ffcc33',
width: 2
}),
image: new ol.style.Circle({
radius: 7,
fill: new ol.style.Fill({
color: '#ffcc33'
})
})
})
});
var map = new ol.Map({
@@ -31,9 +51,30 @@ var draw; // global so we can remove it later
function addInteraction() {
var value = typeSelect.value;
if (value !== 'None') {
var geometryFunction, maxPoints;
if (value === 'Square') {
value = 'Circle';
geometryFunction = ol.interaction.Draw.createRegularPolygon(4);
} else if (value === 'Box') {
value = 'LineString';
maxPoints = 2;
geometryFunction = function(coordinates, geometry) {
if (!geometry) {
geometry = new ol.geom.Polygon(null);
}
var start = coordinates[0];
var end = coordinates[1];
geometry.setCoordinates([
[start, [start[0], end[1]], end, [end[0], start[1]], start]
]);
return geometry;
};
}
draw = new ol.interaction.Draw({
source: source,
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value)
type: /** @type {ol.geom.GeometryType} */ (value),
geometryFunction: geometryFunction,
maxPoints: maxPoints
});
map.addInteraction(draw);
}

View File

@@ -1,22 +0,0 @@
---
layout: example.html
title: Freehand Drawing
shortdesc: Example using the ol.interaction.Draw interaction in freehand mode.
docs: >
This example demonstrates the `ol.interaction.Draw` in freehand mode. During
freehand drawing, points are added while dragging. Set `freehand: true` to
enable freehand mode. Note that freehand mode can be conditionally enabled
by using the `freehandCondition` option. For example to toggle freehand mode
with the `Shift` key, use `freehandCondition: ol.events.condition.shiftKeyOnly`.
tags: "draw, edit, freehand, vector"
---
<div id="map" class="map"></div>
<form class="form-inline">
<label>Geometry type &nbsp;</label>
<select id="type">
<option value="LineString">LineString</option>
<option value="Polygon">Polygon</option>
<option value="Circle">Circle</option>
<option value="None">None</option>
</select>
</form>

View File

@@ -1,52 +0,0 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.interaction.Draw');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var source = new ol.source.Vector({wrapX: false});
var vector = new ol.layer.Vector({
source: source
});
var map = new ol.Map({
layers: [raster, vector],
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],
zoom: 4
})
});
var typeSelect = document.getElementById('type');
var draw; // global so we can remove it later
function addInteraction() {
var value = typeSelect.value;
if (value !== 'None') {
draw = new ol.interaction.Draw({
source: source,
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value),
freehand: true
});
map.addInteraction(draw);
}
}
/**
* Handle change event.
*/
typeSelect.onchange = function() {
map.removeInteraction(draw);
addInteraction();
};
addInteraction();

View File

@@ -1,25 +0,0 @@
---
layout: example.html
title: Draw Shapes
shortdesc: Using the ol.interaction.Draw to create regular shapes
docs: >
This demonstrates the use of the `geometryFunction` option for the
`ol.interaction.Draw`. Select a shape type from the dropdown above to start
drawing. To activate freehand drawing, hold the `Shift` key. Square drawing is
achieved by using `type: 'Circle'` type with a `geometryFunction` that creates
a 4-sided regular polygon instead of a circle. Box drawing uses `type: 'Circle'`
with a `geometryFunction` that creates a box-shaped polygon instead of a
circle. Star drawing uses a custom geometry function that coverts a circle
into a start using the center and radius provided by the draw interaction.
tags: "draw, edit, freehand, vector"
---
<div id="map" class="map"></div>
<form class="form-inline">
<label>Shape type &nbsp;</label>
<select id="type">
<option value="Square">Square</option>
<option value="Box">Box</option>
<option value="Star">Star</option>
<option value="None">None</option>
</select>
</form>

View File

@@ -1,86 +0,0 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Polygon');
goog.require('ol.interaction.Draw');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var source = new ol.source.Vector({wrapX: false});
var vector = new ol.layer.Vector({
source: source
});
var map = new ol.Map({
layers: [raster, vector],
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],
zoom: 4
})
});
var typeSelect = document.getElementById('type');
var draw; // global so we can remove it later
function addInteraction() {
var value = typeSelect.value;
if (value !== 'None') {
var geometryFunction;
if (value === 'Square') {
value = 'Circle';
geometryFunction = ol.interaction.Draw.createRegularPolygon(4);
} else if (value === 'Box') {
value = 'Circle';
geometryFunction = ol.interaction.Draw.createBox();
} else if (value === 'Star') {
value = 'Circle';
geometryFunction = function(coordinates, geometry) {
if (!geometry) {
geometry = new ol.geom.Polygon(null);
}
var center = coordinates[0];
var last = coordinates[1];
var dx = center[0] - last[0];
var dy = center[1] - last[1];
var radius = Math.sqrt(dx * dx + dy * dy);
var rotation = Math.atan2(dy, dx);
var newCoordinates = [];
var numPoints = 12;
for (var i = 0; i < numPoints; ++i) {
var angle = rotation + i * 2 * Math.PI / numPoints;
var fraction = i % 2 === 0 ? 1 : 0.5;
var offsetX = radius * fraction * Math.cos(angle);
var offsetY = radius * fraction * Math.sin(angle);
newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
}
newCoordinates.push(newCoordinates[0].slice());
geometry.setCoordinates([newCoordinates]);
return geometry;
};
}
draw = new ol.interaction.Draw({
source: source,
type: /** @type {ol.geom.GeometryType} */ (value),
geometryFunction: geometryFunction
});
map.addInteraction(draw);
}
}
/**
* Handle change event.
*/
typeSelect.onchange = function() {
map.removeInteraction(draw);
addInteraction();
};
addInteraction();

View File

@@ -9,7 +9,7 @@ goog.require('ol.source.TileWMS');
var layers = [
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
}

View File

@@ -3,12 +3,12 @@ layout: example.html
title: Map Export
shortdesc: Example of exporting a map as a PNG image.
docs: >
Example of exporting a map as a PNG image. This example requires a browser
that supports <a href="https://developer.mozilla.org/de/docs/Web/API/HTMLCanvasElement/toBlob#Browser_compatibility">
<code>canvas.toBlob()</code></a>.
Example of exporting a map as a PNG image.
tags: "export, png, openstreetmap"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js
---
<div id="map" class="map"></div>
<a id="export-png" class="btn btn-default"><i class="fa fa-download"></i> Download PNG</a>
<div id="no-download" class="alert alert-danger" style="display: none">
This example requires a browser that supports the
<a href="http://caniuse.com/#feat=download">link download</a> attribute.
</div>
<a id="export-png" class="btn btn-default" download="map.png"><i class="fa fa-download"></i> Download PNG</a>

View File

@@ -1,5 +1,3 @@
// NOCOMPILE
// this example uses FileSaver.js for which we don't have an externs file.
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.control');
@@ -33,12 +31,20 @@ var map = new ol.Map({
})
});
document.getElementById('export-png').addEventListener('click', function() {
map.once('postcompose', function(event) {
var canvas = event.context.canvas;
canvas.toBlob(function(blob) {
saveAs(blob, 'map.png');
var exportPNGElement = document.getElementById('export-png');
if ('download' in exportPNGElement) {
exportPNGElement.addEventListener('click', function() {
map.once('postcompose', function(event) {
var canvas = event.context.canvas;
exportPNGElement.href = canvas.toDataURL('image/png');
});
});
map.renderSync();
});
map.renderSync();
}, false);
} else {
var info = document.getElementById('no-download');
/**
* display error message
*/
info.style.display = '';
}

View File

@@ -44,6 +44,7 @@ tags: "fullscreen, geolocation, orientation, mobile"
<button id="geolocate">Geolocate Me!</button>
<button id="simulate">Simulate</button>
</div>
<script src="http://code.jquery.com/jquery-2.2.3.min.js" type="text/javascript"></script>
<script src="./resources/common.js" type="text/javascript"></script>
<script src="loader.js?id=geolocation-orientation" type="text/javascript"></script>
</body>

View File

@@ -130,6 +130,26 @@ function addPosition(position, heading, m, speed) {
}
}
var previousM = 0;
// change center and rotation before render
map.beforeRender(function(map, frameState) {
if (frameState !== null) {
// use sampling period to get a smooth transition
var m = frameState.time - deltaMean * 1.5;
m = Math.max(m, previousM);
previousM = m;
// interpolate position along positions LineString
var c = positions.getCoordinateAtM(m, true);
var view = frameState.viewState;
if (c) {
view.center = getCenterWithHeading(c, -c[2], view.resolution);
view.rotation = -c[2];
marker.setPosition(c);
}
}
return true; // Force animation to continue
});
// recenters the view by putting the given coordinates at 3/4 from the top or
// the screen
function getCenterWithHeading(position, rotation, resolution) {
@@ -142,19 +162,9 @@ function getCenterWithHeading(position, rotation, resolution) {
];
}
var previousM = 0;
function updateView() {
// use sampling period to get a smooth transition
var m = Date.now() - deltaMean * 1.5;
m = Math.max(m, previousM);
previousM = m;
// interpolate position along positions LineString
var c = positions.getCoordinateAtM(m, true);
if (c) {
view.setCenter(getCenterWithHeading(c, -c[2], view.getResolution()));
view.setRotation(-c[2]);
marker.setPosition(c);
}
// postcompose callback
function render() {
map.render();
}
// geolocate device
@@ -162,7 +172,7 @@ var geolocateBtn = document.getElementById('geolocate');
geolocateBtn.addEventListener('click', function() {
geolocation.setTracking(true); // Start position tracking
map.on('postcompose', updateView);
map.on('postcompose', render);
map.render();
disableButtons();
@@ -204,7 +214,7 @@ simulateBtn.addEventListener('click', function() {
}
geolocate();
map.on('postcompose', updateView);
map.on('postcompose', render);
map.render();
disableButtons();

View File

@@ -5,7 +5,7 @@ goog.require('ol.source.ImageWMS');
var wmsSource = new ol.source.ImageWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'ne:ne'},
serverType: 'geoserver',
crossOrigin: 'anonymous'

View File

@@ -5,7 +5,7 @@ goog.require('ol.source.TileWMS');
var wmsSource = new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'ne:ne'},
serverType: 'geoserver',
crossOrigin: 'anonymous'

View File

@@ -3,7 +3,7 @@ layout: example.html
title: IGC Data
shortdesc: Example of tracks recorded from multiple paraglider flights on the same day, read from an IGC file.
docs: >
<p>The five tracks contain a total of 49,707 unique coordinates. Zoom in to see more detail. The background layer is from <a href="https://www.opencyclemap.org/">OpenCycleMap</a>.</p>
<p>The five tracks contain a total of 49,707 unique coordinates. Zoom in to see more detail. The background layer is from <a href="http://www.opencyclemap.org/">OpenCycleMap</a>.</p>
tags: "complex-geometry, closest-feature, igc, opencyclemap"
---
<div id="map" class="map"></div>

View File

@@ -85,10 +85,10 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.OSM({
attributions: [
'All maps © <a href="https://www.opencyclemap.org/">OpenCycleMap</a>',
'All maps © <a href="http://www.opencyclemap.org/">OpenCycleMap</a>',
ol.source.OSM.ATTRIBUTION
],
url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png'
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
})
}),
new ol.layer.Vector({

View File

@@ -78,7 +78,7 @@ Progress.prototype.hide = function() {
var progress = new Progress(document.getElementById('progress'));
var source = new ol.source.ImageWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'topp:states'},
serverType: 'geoserver'
});

View File

@@ -38,7 +38,7 @@ var styleFunction = function(feature) {
image: new ol.style.Icon({
src: 'data/arrow.png',
anchor: [0.75, 0.5],
rotateWithView: true,
rotateWithView: false,
rotation: -rotation
})
}));

View File

@@ -3,7 +3,7 @@ layout: example.html
title: Localized OpenStreetMap
shortdesc: Example of a localized OpenStreetMap map with a custom tile server and a custom attribution.
docs: >
<p>The base layer is <a href="https://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>.
<p>The base layer is <a href="http://www.opencyclemap.org/">OpenCycleMap</a> with an overlay from <a href="http://www.openseamap.org/">OpenSeaMap</a>.
tags: "localized-openstreetmap, openseamap, openstreetmap"
---
<div id="map" class="map"></div>

View File

@@ -8,10 +8,10 @@ goog.require('ol.source.OSM');
var openCycleMapLayer = new ol.layer.Tile({
source: new ol.source.OSM({
attributions: [
'All maps © <a href="https://www.opencyclemap.org/">OpenCycleMap</a>',
'All maps © <a href="http://www.opencyclemap.org/">OpenCycleMap</a>',
ol.source.OSM.ATTRIBUTION
],
url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png'
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
})
});
@@ -22,7 +22,7 @@ var openSeaMapLayer = new ol.layer.Tile({
ol.source.OSM.ATTRIBUTION
],
opaque: false,
url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'
url: 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'
})
});

View File

@@ -47,7 +47,7 @@ var map = new ol.Map({
preload: Infinity,
source: new ol.source.VectorTile({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' +
'© <a href="http://www.openstreetmap.org/copyright">' +
'OpenStreetMap contributors</a>',
format: new ol.format.MVT(),
tileGrid: new ol.tilegrid.TileGrid({

View File

@@ -20,7 +20,7 @@ var map = new ol.Map({
new ol.layer.VectorTile({
source: new ol.source.VectorTile({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' +
'© <a href="http://www.openstreetmap.org/copyright">' +
'OpenStreetMap contributors</a>',
format: new ol.format.MVT(),
tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}),

View File

@@ -29,7 +29,7 @@ var styleFunction = (function() {
color: 'rgba(0, 0, 255, 0.1)'
})
});
styles['MultiLineString'] = new ol.style.Style({
styles['MultiLinestring'] = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 3

View File

@@ -42,7 +42,7 @@ var map = new ol.Map({
attributions: attribution,
format: format,
tileGrid: tileGrid,
url: 'https://tile.mapzen.com/mapzen/vector/v1/water/{z}/{x}/{y}.topojson?api_key=' + key
url: 'https://vector.mapzen.com/osm/water/{z}/{x}/{y}.topojson?api_key=' + key
}),
style: new ol.style.Style({
fill: new ol.style.Fill({
@@ -55,7 +55,7 @@ var map = new ol.Map({
attributions: attribution,
format: format,
tileGrid: tileGrid,
url: 'https://tile.mapzen.com/mapzen/vector/v1/roads/{z}/{x}/{y}.topojson?api_key=' + key
url: 'https://vector.mapzen.com/osm/roads/{z}/{x}/{y}.topojson?api_key=' + key
}),
style: function(feature) {
var kind = feature.get('kind');
@@ -89,7 +89,7 @@ var map = new ol.Map({
attributions: attribution,
format: format,
tileGrid: tileGrid,
url: 'https://tile.mapzen.com/mapzen/vector/v1/buildings/{z}/{x}/{y}.topojson?api_key=' + key
url: 'https://vector.mapzen.com/osm/buildings/{z}/{x}/{y}.topojson?api_key=' + key
}),
style: function(f, resolution) {
return (resolution < 10) ? buildingStyle : null;

View File

@@ -14,7 +14,7 @@ var overviewMapControl = new ol.control.OverviewMap({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM({
'url': 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png'
'url': 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
})
})
],

View File

@@ -5,10 +5,10 @@ shortdesc: Demonstrates client-side raster reprojection of OSM to arbitrary proj
docs: >
This example shows client-side raster reprojection capabilities from
OSM (EPSG:3857) to arbitrary projection by searching
in <a href="https://epsg.io/">EPSG.io</a> database.
in <a href="http://epsg.io/">EPSG.io</a> database.
tags: "reprojection, projection, proj4js, epsg.io"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -63,7 +63,7 @@ function setProjection(code, name, proj4def, bbox) {
function search(query) {
resultSpan.innerHTML = 'Searching ...';
fetch('https://epsg.io/?format=json&q=' + query).then(function(response) {
fetch('http://epsg.io/?format=json&q=' + query).then(function(response) {
return response.json();
}).then(function(json) {
var results = json['results'];

View File

@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of single image source.
tags: "reprojection, projection, proj4js, image, imagestatic"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -21,7 +21,7 @@ var map = new ol.Map({
}),
new ol.layer.Image({
source: new ol.source.ImageStatic({
url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' +
url: 'http://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' +
'British_National_Grid.svg/2000px-British_National_Grid.svg.png',
crossOrigin: '',
projection: 'EPSG:27700',

View File

@@ -6,7 +6,7 @@ docs: >
This example shows client-side raster reprojection between various projections.
tags: "reprojection, projection, proj4js, osm, wms, wmts, hidpi"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -69,7 +69,7 @@ layers['osm'] = new ol.layer.Tile({
layers['wms4326'] = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
crossOrigin: '',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
@@ -93,7 +93,7 @@ layers['wms21781'] = new ol.layer.Tile({
});
var parser = new ol.format.WMTSCapabilities();
var url = 'https://map1.vis.earthdata.nasa.gov/wmts-arctic/' +
var url = 'http://map1.vis.earthdata.nasa.gov/wmts-arctic/' +
'wmts.cgi?SERVICE=WMTS&request=GetCapabilities';
fetch(url).then(function(response) {
return response.text();
@@ -129,7 +129,7 @@ for (var i = 0, ii = resolutions.length; i < ii; ++i) {
layers['states'] = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
crossOrigin: '',
params: {'LAYERS': 'topp:states', 'TILED': true},
serverType: 'geoserver',

View File

@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units.
tags: "reprojection, projection, openstreetmap, nad83, tile, scaleline"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -1,9 +0,0 @@
#level {
display: inline-block;
width: 150px;
vertical-align: text-bottom;
}
a.location {
cursor: pointer;
}

View File

@@ -1,26 +0,0 @@
---
layout: example.html
title: Sea Level
shortdesc: Render sea level at different elevations
docs: >
<p>
This example uses a <code>ol.source.Raster</code> with
<a href="https://www.mapbox.com/blog/terrain-rgb/">Mapbox Terrain-RGB tiles</a>
to "flood" areas below the elevation shown on the sea level slider.
</p>
tags: "raster, pixel operation, flood"
cloak:
pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg: Your Mapbox access token from http://mapbox.com/ here
---
<div id="map" class="map"></div>
<label>
Sea level
<input id="level" type="range" min="0" max="100" value="1"/>
+<span id="output"></span> m
</label>
<br>
Go to
<a class="location" data-center="-122.3267,37.8377" data-zoom="11">San Francisco</a>,
<a class="location" data-center="-73.9338,40.6861" data-zoom="11">New York</a>,
<a class="location" data-center="72.9481,18.9929" data-zoom="11">Mumbai</a>, or
<a class="location" data-center="120.831,31.160" data-zoom="9">Shanghai</a>

View File

@@ -1,78 +0,0 @@
// NOCOMPILE
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Image');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.Raster');
goog.require('ol.source.XYZ');
function flood(pixels, data) {
var pixel = pixels[0];
if (pixel[3]) {
var height = -10000 + ((pixel[0] * 256 * 256 + pixel[1] * 256 + pixel[2]) * 0.1);
if (height <= data.level) {
pixel[0] = 145;
pixel[1] = 175;
pixel[2] = 186;
pixel[3] = 255;
} else {
pixel[3] = 0;
}
}
return pixel;
}
var key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
var elevation = new ol.source.XYZ({
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
crossOrigin: 'anonymous'
});
var raster = new ol.source.Raster({
sources: [elevation],
operation: flood
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
url: 'https://api.mapbox.com/styles/v1/tschaub/ciutc102t00c62js5fqd47kqw/tiles/256/{z}/{x}/{y}?access_token=' + key
})
}),
new ol.layer.Image({
opacity: 0.6,
source: raster
})
],
view: new ol.View({
center: ol.proj.fromLonLat([-122.3267, 37.8377]),
zoom: 11
})
});
var control = document.getElementById('level');
var output = document.getElementById('output');
control.addEventListener('input', function() {
output.innerText = control.value;
raster.changed();
});
output.innerText = control.value;
raster.on('beforeoperations', function(event) {
event.data.level = control.value;
});
var locations = document.getElementsByClassName('location');
for (var i = 0, ii = locations.length; i < ii; ++i) {
locations[i].addEventListener('click', relocate);
}
function relocate(event) {
var data = event.target.dataset;
var view = map.getView();
view.setCenter(ol.proj.fromLonLat(data.center.split(',').map(Number)));
view.setZoom(Number(data.zoom));
}

View File

@@ -1,7 +0,0 @@
@media (min-width: 800px) {
.half {
padding: 0 10px;
width: 50%;
float: left;
}
}

View File

@@ -6,14 +6,10 @@ docs: >
Two maps (one with the Canvas renderer, one with the WebGL renderer) share the same center, resolution, rotation and layers.
tags: "side-by-side, canvas, webgl"
---
<div class="half">
<h4>Canvas</h4>
<div id="canvasMap" class="map"></div>
</div>
<div class="half">
<h4>WebGL</h4>
<div id="webglMap" class="map"></div>
<div id="no-webgl" class="alert alert-danger" style="display: none">
This map requires a browser that supports <a href="http://get.webgl.org/">WebGL</a>.
</div>
<h4>Canvas</h4>
<div id="canvasMap" class="map"></div>
<h4>WebGL</h4>
<div id="webglMap" class="map"></div>
<div id="no-webgl" class="alert alert-danger" style="display: none">
This map requires a browser that supports <a href="http://get.webgl.org/">WebGL</a>.
</div>

View File

@@ -6,6 +6,6 @@ docs: >
Example of a Sphere Mollweide map with a Graticule component.
tags: "graticule, Mollweide, projection, proj4js"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -20,7 +20,7 @@ var map4326 = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
}
@@ -40,7 +40,7 @@ var map3857 = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
}

View File

@@ -14,7 +14,7 @@ goog.require('ol.source.XYZ');
goog.require('ol.tilegrid');
var serviceUrl = 'https://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/' +
var serviceUrl = 'http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/' +
'services/PDX_Pedestrian_Districts/FeatureServer/';
var layer = '0';
@@ -55,7 +55,7 @@ var vector = new ol.layer.Vector({
var raster = new ol.layer.Tile({
source: new ol.source.XYZ({
attributions: 'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
attributions: 'Tiles © <a href="http://services.arcgisonline.com/ArcGIS/' +
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>',
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' +
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'

View File

@@ -13,7 +13,7 @@ goog.require('ol.style.Style');
goog.require('ol.tilegrid');
var serviceUrl = 'https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/' +
var serviceUrl = 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/' +
'Petroleum/KSFields/FeatureServer/';
var layer = '0';
@@ -97,7 +97,7 @@ var vector = new ol.layer.Vector({
var raster = new ol.layer.Tile({
source: new ol.source.XYZ({
attributions: 'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
attributions: 'Tiles © <a href="http://services.arcgisonline.com/ArcGIS/' +
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>',
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' +
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'

View File

@@ -3,8 +3,8 @@ layout: example.html
title: OSM XML
shortdesc: Example of using the OSM XML source.
docs: >
OSM XML vector data is loaded dynamically from a the [Overpass API](http://overpass-api.de) using a bbox strategy. Note that panning and zooming will eventually lead to "Too many requests" errors from the Overpass API.
tags: "vector, osmxml, loading, server, strategy, bbox"
OSM XML vector data is loaded dynamically from a server using a tiling strategy.
tags: "vector, osm, xml, loading, server"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---

View File

@@ -12,8 +12,7 @@ goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Style');
var map;
goog.require('ol.tilegrid');
var styles = {
'amenity': {
@@ -79,24 +78,15 @@ var styles = {
var vectorSource = new ol.source.Vector({
format: new ol.format.OSMXML(),
loader: function(extent, resolution, projection) {
url: function(extent, resolution, projection) {
var epsg4326Extent =
ol.proj.transformExtent(extent, projection, 'EPSG:4326');
var client = new XMLHttpRequest();
client.open('POST', 'https://overpass-api.de/api/interpreter');
client.addEventListener('load', function() {
var features = new ol.format.OSMXML().readFeatures(client.responseText, {
featureProjection: map.getView().getProjection()
});
vectorSource.addFeatures(features);
});
var query = '(node(' +
epsg4326Extent[1] + ',' + epsg4326Extent[0] + ',' +
epsg4326Extent[3] + ',' + epsg4326Extent[2] +
');rel(bn)->.foo;way(bn);node(w)->.foo;rel(bw););out meta;';
client.send(query);
return 'http://overpass-api.de/api/xapi?map?bbox=' +
epsg4326Extent.join(',');
},
strategy: ol.loadingstrategy.bbox
strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({
maxZoom: 19
}))
});
var vector = new ol.layer.Vector({
@@ -123,7 +113,7 @@ var raster = new ol.layer.Tile({
})
});
map = new ol.Map({
var map = new ol.Map({
layers: [raster, vector],
target: document.getElementById('map'),
controls: ol.control.defaults({

View File

@@ -53,7 +53,7 @@ var featureRequest = new ol.format.WFS().writeGetFeature({
});
// then post the request and add the received features to a layer
fetch('https://ahocevar.com/geoserver/wfs', {
fetch('http://demo.boundlessgeo.com/geoserver/wfs', {
method: 'POST',
body: new XMLSerializer().serializeToString(featureRequest)
}).then(function(response) {

View File

@@ -13,7 +13,7 @@ goog.require('ol.style.Style');
var vectorSource = new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: function(extent) {
return 'https://ahocevar.com/geoserver/wfs?service=WFS&' +
return 'http://demo.boundlessgeo.com/geoserver/wfs?service=WFS&' +
'version=1.1.0&request=GetFeature&typename=osm:water_areas&' +
'outputFormat=application/json&srsname=EPSG:3857&' +
'bbox=' + extent.join(',') + ',EPSG:3857';

View File

@@ -16,7 +16,7 @@ goog.require('ol.source.TileWMS');
var projection = new ol.proj.Projection({
code: 'EPSG:21781',
// The extent is used to determine zoom level 0. Recommended values for a
// projection's validity extent can be found at https://epsg.io/.
// projection's validity extent can be found at http://epsg.io/.
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864],
units: 'm'
});

View File

@@ -26,7 +26,7 @@ var layers = [
}),
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'topp:states', 'TILED': true},
serverType: 'geoserver',
tileGrid: tileGrid

View File

@@ -6,7 +6,7 @@ docs: >
With [Proj4js](http://proj4js.org/) integration, OpenLayers can transform coordinates between arbitrary projections.
tags: "wms, single image, proj4js, projection"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js
- https://epsg.io/21781-1753.js
---
<div id="map" class="map"></div>

View File

@@ -17,7 +17,7 @@ goog.require('ol.source.ImageWMS');
//
// Note that we are setting the projection's extent here, which is used to
// determine the view resolution for zoom level 0. Recommended values for a
// projection's validity extent can be found at https://epsg.io/.
// projection's validity extent can be found at http://epsg.io/.
//
// If you use Proj4js only to transform coordinates, you don't even need to
// create an ol.proj.Projection instance. ol.proj.get() will take care of it

View File

@@ -13,7 +13,7 @@ var layers = [
new ol.layer.Image({
extent: [-13884991, 2870341, -7455066, 6338219],
source: new ol.source.ImageWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'topp:states'},
serverType: 'geoserver'
})

View File

@@ -11,7 +11,7 @@ var layers = [
}),
new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/ne/wms',
url: 'http://demo.boundlessgeo.com/geoserver/ne/wms',
params: {'LAYERS': 'ne:ne_10m_admin_0_countries', 'TILED': true},
serverType: 'geoserver'
})

View File

@@ -12,7 +12,7 @@ var layers = [
new ol.layer.Tile({
extent: [-13884991, 2870341, -7455066, 6338219],
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
url: 'http://demo.boundlessgeo.com/geoserver/wms',
params: {'LAYERS': 'topp:states', 'TILED': true},
serverType: 'geoserver'
})

View File

@@ -25,7 +25,7 @@ var layers = [
extent: extent,
source: new ol.source.TileWMS(/** @type {olx.source.TileWMSOptions} */ ({
attributions: ['Iowa State University'],
url: 'https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi',
url: 'http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi',
params: {'LAYERS': 'nexrad-n0r-wmst'}
}))
})

View File

@@ -52,7 +52,7 @@ var ign_source = new ol.source.WMTS({
style: 'normal',
attributions: [new ol.Attribution({
html: '<a href="http://www.geoportail.fr/" target="_blank">' +
'<img src="https://api.ign.fr/geoportail/api/js/latest/' +
'<img src="http://api.ign.fr/geoportail/api/js/latest/' +
'theme/geoportal/img/logo_gp.gif"></a>'
})]
});

View File

@@ -29,7 +29,7 @@ var map = new ol.Map({
new ol.layer.Tile({
opacity: 0.7,
source: new ol.source.WMTS({
attributions: 'Tiles © <a href="https://services.arcgisonline.com/arcgis/rest/' +
attributions: 'Tiles © <a href="http://services.arcgisonline.com/arcgis/rest/' +
'services/Demographics/USA_Population_Density/MapServer/">ArcGIS</a>',
url: 'https://services.arcgisonline.com/arcgis/rest/' +
'services/Demographics/USA_Population_Density/MapServer/WMTS/',

View File

@@ -14,7 +14,7 @@ var projection = ol.proj.get('EPSG:4326');
// The tile size supported by the ArcGIS tile service.
var tileSize = 512;
var urlTemplate = 'https://services.arcgisonline.com/arcgis/rest/services/' +
var urlTemplate = 'http://services.arcgisonline.com/arcgis/rest/services/' +
'ESRI_Imagery_World_2D/MapServer/tile/{z}/{y}/{x}';
var map = new ol.Map({

View File

@@ -7,7 +7,7 @@ goog.require('ol.source.XYZ');
var attribution = new ol.Attribution({
html: 'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
html: 'Tiles © <a href="http://services.arcgisonline.com/ArcGIS/' +
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>'
});

View File

@@ -9,7 +9,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png'
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
})
})
],

View File

@@ -312,7 +312,7 @@ olx.MapOptions.prototype.view;
* stopEvent: (boolean|undefined),
* insertFirst: (boolean|undefined),
* autoPan: (boolean|undefined),
* autoPanAnimation: (olx.OverlayPanOptions|undefined),
* autoPanAnimation: (olx.animation.PanOptions|undefined),
* autoPanMargin: (number|undefined)}}
*/
olx.OverlayOptions;
@@ -398,10 +398,10 @@ olx.OverlayOptions.prototype.autoPan;
/**
* The animation options used to pan the overlay into view. This animation
* is only used when `autoPan` is enabled. A `duration` and `easing` may be
* provided to customize the animation.
* @type {olx.OverlayPanOptions|undefined}
* The options used to create a `ol.animation.pan` animation. This animation
* is only used when `autoPan` is enabled. By default the default options for
* `ol.animation.pan` are used. If set to `null` the panning is not animated.
* @type {olx.animation.PanOptions|undefined}
* @api
*/
olx.OverlayOptions.prototype.autoPanAnimation;
@@ -416,32 +416,6 @@ olx.OverlayOptions.prototype.autoPanAnimation;
olx.OverlayOptions.prototype.autoPanMargin;
/**
* @typedef {{
* duration: (number|undefined),
* easing: (function(number):number|undefined)
* }}
*/
olx.OverlayPanOptions;
/**
* The duration of the animation in milliseconds. Default is `1000`.
* @type {number|undefined}
* @api
*/
olx.OverlayPanOptions.prototype.duration;
/**
* The easing function to use. Can be an {@link ol.easing} or a custom function.
* Default is {@link ol.easing.inAndOut}.
* @type {function(number):number|undefined}
* @api
*/
olx.OverlayPanOptions.prototype.easing;
/**
* Object literal with config options for the projection.
* @typedef {{code: string,
@@ -687,81 +661,6 @@ olx.ViewOptions.prototype.zoom;
olx.ViewOptions.prototype.zoomFactor;
/**
* @typedef {{
* center: (ol.Coordinate|undefined),
* zoom: (number|undefined),
* resolution: (number|undefined),
* rotation: (number|undefined),
* anchor: (ol.Coordinate|undefined),
* duration: (number|undefined),
* easing: (function(number):number|undefined)
* }}
*/
olx.AnimationOptions;
/**
* The center of the view at the end of the animation.
* @type {ol.Coordinate|undefined}
* @api
*/
olx.AnimationOptions.prototype.center;
/**
* The zoom level of the view at the end of the animation. This takes
* precedence over `resolution`.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.zoom;
/**
* The resolution of the view at the end of the animation. If `zoom` is also
* provided, this option will be ignored.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.resolution;
/**
* The rotation of the view at the end of the animation.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.rotation;
/**
* Optional anchor to remained fixed during a rotation or resolution animation.
* @type {ol.Coordinate|undefined}
* @api
*/
olx.AnimationOptions.prototype.anchor;
/**
* The duration of the animation in milliseconds (defaults to `1000`).
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.duration;
/**
* The easing function used during the animation (defaults to {@link ol.easing.inAndOut}).
* The function will be called for each frame with a number representing a
* fraction of the animation's duration. The function should return a number
* between 0 and 1 representing the progress toward the destination state.
* @type {function(number):number|undefined}
* @api
*/
olx.AnimationOptions.prototype.easing;
/**
* Namespace.
* @type {Object}
@@ -989,7 +888,7 @@ olx.control.AttributionOptions.prototype.target;
/**
* Specify if attributions can be collapsed. If you use an OSM source,
* should be set to `false` — see
* {@link https://www.openstreetmap.org/copyright OSM Copyright} —
* {@link http://www.openstreetmap.org/copyright OSM Copyright} —
* Default is `true`.
* @type {boolean|undefined}
* @api
@@ -1767,8 +1666,7 @@ olx.format.WriteOptions.prototype.decimals;
/**
* @typedef {{defaultDataProjection: ol.ProjectionLike,
* geometryName: (string|undefined),
* featureProjection: ol.ProjectionLike}}
* geometryName: (string|undefined)}}
*/
olx.format.GeoJSONOptions;
@@ -1781,15 +1679,6 @@ olx.format.GeoJSONOptions;
olx.format.GeoJSONOptions.prototype.defaultDataProjection;
/**
* Projection for features read or written by the format. Options passed to
* read or write methods will take precedence.
* @type {ol.ProjectionLike}
* @api stable
*/
olx.format.GeoJSONOptions.prototype.featureProjection;
/**
* Geometry name to use when creating features.
* @type {string|undefined}
@@ -2683,7 +2572,6 @@ olx.interaction.DragZoomOptions.prototype.out;
* geometryFunction: (ol.DrawGeometryFunctionType|undefined),
* geometryName: (string|undefined),
* condition: (ol.EventsConditionType|undefined),
* freehand: (boolean|undefined),
* freehandCondition: (ol.EventsConditionType|undefined),
* wrapX: (boolean|undefined)}}
*/
@@ -2797,16 +2685,6 @@ olx.interaction.DrawOptions.prototype.geometryName;
olx.interaction.DrawOptions.prototype.condition;
/**
* Operate in freehand mode for lines, polygons, and circles. This makes the
* interaction always operate in freehand mode and takes precedence over any
* `freehandCondition` option.
* @type {boolean|undefined}
* @api
*/
olx.interaction.DrawOptions.prototype.freehand;
/**
* Condition that activates freehand drawing for lines and polygons. This
* function takes an {@link ol.MapBrowserEvent} and returns a boolean to
@@ -3036,7 +2914,6 @@ olx.interaction.ModifyOptions.prototype.wrapX;
/**
* @typedef {{duration: (number|undefined),
* timeout: (number|undefined),
* useAnchor: (boolean|undefined)}}
*/
olx.interaction.MouseWheelZoomOptions;
@@ -3050,14 +2927,6 @@ olx.interaction.MouseWheelZoomOptions;
olx.interaction.MouseWheelZoomOptions.prototype.duration;
/**
* Mouse wheel timeout duration in milliseconds. Default is `80`.
* @type {number|undefined}
* @api
*/
olx.interaction.MouseWheelZoomOptions.prototype.timeout;
/**
* Enable zooming using the mouse's location as the anchor. Default is `true`.
* When set to false, zooming in and out will zoom to the center of the screen
@@ -4135,7 +4004,6 @@ olx.source;
/**
* @typedef {{cacheSize: (number|undefined),
* culture: (string|undefined),
* hidpi: (boolean|undefined),
* key: string,
* imagerySet: string,
* maxZoom: (number|undefined),
@@ -4154,14 +4022,6 @@ olx.source.BingMapsOptions;
olx.source.BingMapsOptions.prototype.cacheSize;
/**
* If `true` hidpi tiles will be requested. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.source.BingMapsOptions.prototype.hidpi;
/**
* Culture code. Default is `en-us`.
* @type {string|undefined}

View File

@@ -1,13 +1,13 @@
{
"name": "openlayers",
"version": "3.20.0-beta.1",
"version": "3.19.0-beta.1",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",
"mapping",
"ol3"
],
"homepage": "https://openlayers.org/",
"homepage": "http://openlayers.org/",
"scripts": {
"install": "node tasks/install.js",
"postinstall": "closure-util update",
@@ -30,19 +30,19 @@
"css/ol.css"
],
"dependencies": {
"async": "2.1.2",
"browserify": "13.1.1",
"async": "2.0.1",
"browserify": "13.1.0",
"closure-util": "1.15.1",
"derequire": "2.0.3",
"fs-extra": "1.0.0",
"glob": "7.1.1",
"handlebars": "4.0.6",
"jsdoc": "3.4.2",
"fs-extra": "0.30.0",
"glob": "7.1.0",
"handlebars": "4.0.5",
"jsdoc": "3.4.1",
"marked": "0.3.6",
"metalsmith": "2.3.0",
"metalsmith-layouts": "1.7.0",
"metalsmith": "2.2.0",
"metalsmith-layouts": "1.6.5",
"nomnom": "1.8.1",
"pbf": "3.0.4",
"pbf": "3.0.1",
"pixelworks": "1.1.0",
"rbush": "2.0.1",
"temp": "0.8.3",
@@ -50,22 +50,22 @@
"walk": "2.3.9"
},
"devDependencies": {
"clean-css": "3.4.21",
"coveralls": "2.11.15",
"clean-css": "3.4.20",
"coveralls": "2.11.14",
"debounce": "^1.0.0",
"eslint": "3.10.2",
"eslint-config-openlayers": "6.0.0",
"eslint": "3.6.0",
"eslint-config-openlayers": "5.0.0",
"eslint-plugin-openlayers-internal": "2.2.0",
"expect.js": "0.3.1",
"gaze": "^1.0.0",
"istanbul": "0.4.5",
"jquery": "3.1.1",
"mocha": "3.1.2",
"jquery": "3.1.0",
"mocha": "3.0.2",
"mocha-phantomjs-core": "^1.3.0",
"mustache": "2.3.0",
"phantomjs-prebuilt": "2.1.13",
"mustache": "2.2.1",
"phantomjs-prebuilt": "2.1.12",
"proj4": "2.3.15",
"resemblejs": "2.2.2",
"resemblejs": "2.2.1",
"serve-files": "1.0.0",
"sinon": "1.17.6",
"slimerjs": "0.906.2"
@@ -91,8 +91,7 @@
2,
{
"allow": [
"assert",
"warn"
"assert"
]
}
],

View File

@@ -7,7 +7,6 @@ goog.require('ol.easing');
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition that will "bounce" the resolution as it
* approaches the final value.
* @param {olx.animation.BounceOptions} options Bounce options.
@@ -15,7 +14,6 @@ goog.require('ol.easing');
* @api
*/
ol.animation.bounce = function(options) {
ol.DEBUG && console.warn('ol.animation.bounce() is deprecated. Use view.animate() instead.');
var resolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
@@ -47,14 +45,12 @@ ol.animation.bounce = function(options) {
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition while updating the view center.
* @param {olx.animation.PanOptions} options Pan options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.pan = function(options) {
ol.DEBUG && console.warn('ol.animation.pan() is deprecated. Use view.animate() instead.');
var source = options.source;
var start = options.start ? options.start : Date.now();
var sourceX = source[0];
@@ -90,14 +86,12 @@ ol.animation.pan = function(options) {
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition while updating the view rotation.
* @param {olx.animation.RotateOptions} options Rotate options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.rotate = function(options) {
ol.DEBUG && console.warn('ol.animation.rotate() is deprecated. Use view.animate() instead.');
var sourceRotation = options.rotation ? options.rotation : 0;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
@@ -139,14 +133,12 @@ ol.animation.rotate = function(options) {
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition while updating the view resolution.
* @param {olx.animation.ZoomOptions} options Zoom options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.zoom = function(options) {
ol.DEBUG && console.warn('ol.animation.zoom() is deprecated. Use view.animate() instead.');
var sourceResolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;

View File

@@ -17,12 +17,12 @@ ol.AssertionError = function(code) {
* @type {string}
*/
this.message = 'Assertion failed. See ' +
(ol.VERSION ? 'https://openlayers.org/en/' + ol.VERSION.split('-')[0] : '') +
(ol.VERSION ? 'http://openlayers.org/en/' + ol.VERSION.split('-')[0] : '') +
'/doc/errors/#' + code + ' for details.';
/**
* Error code. The meaning of the code can be found on
* {@link https://openlayers.org/en/latest/doc/errors/} (replace `latest` with
* {@link http://openlayers.org/en/latest/errors.html} (replace `latest` with
* the version found in the OpenLayers script's header comment if a version
* other than the latest is used).
* @type {number}

View File

@@ -15,7 +15,7 @@ goog.require('ol.tilegrid');
* attributions: [
* new ol.Attribution({
* html: 'All maps &copy; ' +
* '<a href="https://www.opencyclemap.org/">OpenCycleMap</a>'
* '<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'
* }),
* ol.source.OSM.ATTRIBUTION
* ],

View File

@@ -30,7 +30,7 @@ ol.color.RGB_COLOR_RE_ =
* @private
*/
ol.color.RGBA_COLOR_RE_ =
/^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,16})\)$/i;
/^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,10})\)$/i;
/**

View File

@@ -3,6 +3,7 @@ goog.provide('ol.control.Rotate');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
@@ -130,14 +131,13 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
if (currentRotation > Math.PI) {
currentRotation -= 2 * Math.PI;
}
view.animate({
rotation: 0,
map.beforeRender(ol.animation.rotate({
rotation: currentRotation,
duration: this.duration_,
easing: ol.easing.easeOut
});
} else {
view.setRotation(0);
}));
}
view.setRotation(0);
}
};

View File

@@ -3,6 +3,7 @@ goog.provide('ol.control.Zoom');
goog.require('ol');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
@@ -104,18 +105,14 @@ ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
}
var currentResolution = view.getResolution();
if (currentResolution) {
var newResolution = view.constrainResolution(currentResolution, delta);
if (this.duration_ > 0) {
if (view.getAnimating()) {
view.cancelAnimations();
}
view.animate({
resolution: newResolution,
map.beforeRender(ol.animation.zoom({
resolution: currentResolution,
duration: this.duration_,
easing: ol.easing.easeOut
});
} else {
view.setResolution(newResolution);
}));
}
var newResolution = view.constrainResolution(currentResolution, delta);
view.setResolution(newResolution);
}
};

View File

@@ -4,6 +4,7 @@ goog.provide('ol.control.ZoomSlider');
goog.require('ol');
goog.require('ol.View');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
@@ -232,19 +233,19 @@ ol.control.ZoomSlider.render = function(mapEvent) {
* @private
*/
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
var view = this.getMap().getView();
var map = this.getMap();
var view = map.getView();
var currentResolution = view.getResolution();
map.beforeRender(ol.animation.zoom({
resolution: /** @type {number} */ (currentResolution),
duration: this.duration_,
easing: ol.easing.easeOut
}));
var relativePosition = this.getRelativePosition_(
event.offsetX - this.thumbSize_[0] / 2,
event.offsetY - this.thumbSize_[1] / 2);
var resolution = this.getResolutionForPosition_(relativePosition);
view.animate({
resolution: view.constrainResolution(resolution),
duration: this.duration_,
easing: ol.easing.easeOut
});
view.setResolution(view.constrainResolution(resolution));
};
@@ -305,15 +306,16 @@ ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
*/
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
if (this.dragging_) {
var view = this.getMap().getView();
var map = this.getMap();
var view = map.getView();
view.setHint(ol.View.Hint.INTERACTING, -1);
view.animate({
resolution: view.constrainResolution(this.currentResolution_),
map.beforeRender(ol.animation.zoom({
resolution: /** @type {number} */ (this.currentResolution_),
duration: this.duration_,
easing: ol.easing.easeOut
});
}));
var resolution = view.constrainResolution(this.currentResolution_);
view.setResolution(resolution);
this.dragging_ = false;
this.previousX_ = undefined;
this.previousY_ = undefined;

View File

@@ -1,4 +1,4 @@
/**
* Easing functions for {@link ol.View#animate}.
* Easing functions for {@link ol.animation}.
* @namespace ol.easing
*/

View File

@@ -307,6 +307,18 @@ ol.extent.createOrUpdateFromRings = function(rings, opt_extent) {
};
/**
* Empty an extent in place.
* @param {ol.Extent} extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.empty = function(extent) {
extent[0] = extent[1] = Infinity;
extent[2] = extent[3] = -Infinity;
return extent;
};
/**
* Determine if two extents are equivalent.
* @param {ol.Extent} extent1 Extent 1.
@@ -708,6 +720,29 @@ ol.extent.isEmpty = function(extent) {
};
/**
* @param {ol.Extent} extent Extent.
* @return {boolean} Is infinite.
*/
ol.extent.isInfinite = function(extent) {
return extent[0] == -Infinity || extent[1] == -Infinity ||
extent[2] == Infinity || extent[3] == Infinity;
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.Coordinate} coordinate Coordinate.
* @return {ol.Coordinate} Coordinate.
*/
ol.extent.normalize = function(extent, coordinate) {
return [
(coordinate[0] - extent[0]) / (extent[2] - extent[0]),
(coordinate[1] - extent[1]) / (extent[3] - extent[1])
];
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.Extent=} opt_extent Extent.
@@ -796,6 +831,19 @@ ol.extent.intersectsSegment = function(extent, start, end) {
};
/**
* @param {ol.Extent} extent1 Extent 1.
* @param {ol.Extent} extent2 Extent 2.
* @return {boolean} Touches.
*/
ol.extent.touches = function(extent1, extent2) {
var intersects = ol.extent.intersects(extent1, extent2);
return intersects &&
(extent1[0] == extent2[2] || extent1[2] == extent2[0] ||
extent1[1] == extent2[3] || extent1[3] == extent2[1]);
};
/**
* Apply a transform function to the extent.
* @param {ol.Extent} extent Extent.

View File

@@ -170,8 +170,8 @@ ol.Feature.prototype.getGeometryName = function() {
/**
* Get the feature's style. Will return what was provided to the
* {@link ol.Feature#setStyle} method.
* Get the feature's style. This return for this method depends on what was
* provided to the {@link ol.Feature#setStyle} method.
* @return {ol.style.Style|Array.<ol.style.Style>|
* ol.FeatureStyleFunction} The feature style.
* @api stable

View File

@@ -1,6 +1,7 @@
goog.provide('ol.featureloader');
goog.require('ol');
goog.require('ol.Tile');
goog.require('ol.format.FormatType');
goog.require('ol.xml');
@@ -69,6 +70,35 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
};
/**
* Create an XHR feature loader for a `url` and `format`. The feature loader
* loads features (with XHR), parses the features, and adds them to the
* vector tile.
* @param {string|ol.FeatureUrlFunction} url Feature URL service.
* @param {ol.format.Feature} format Feature format.
* @return {ol.FeatureLoader} The feature loader.
* @api
*/
ol.featureloader.tile = function(url, format) {
return ol.featureloader.loadFeaturesXhr(url, format,
/**
* @param {Array.<ol.Feature>} features The loaded features.
* @param {ol.proj.Projection} dataProjection Data projection.
* @this {ol.VectorTile}
*/
function(features, dataProjection) {
this.setProjection(dataProjection);
this.setFeatures(features);
},
/**
* @this {ol.VectorTile}
*/
function() {
this.setState(ol.Tile.State.ERROR);
});
};
/**
* Create an XHR feature loader for a `url` and `format`. The feature loader
* loads features (with XHR), parses the features, and adds them to the

View File

@@ -1,7 +1,6 @@
goog.provide('ol.format.Feature');
goog.require('ol.geom.Geometry');
goog.require('ol.obj');
goog.require('ol.proj');
@@ -25,12 +24,6 @@ ol.format.Feature = function() {
*/
this.defaultDataProjection = null;
/**
* @protected
* @type {ol.proj.Projection}
*/
this.defaultFeatureProjection = null;
};
@@ -71,10 +64,19 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
* Updated options.
*/
ol.format.Feature.prototype.adaptOptions = function(options) {
return ol.obj.assign({
dataProjection: this.defaultDataProjection,
featureProjection: this.defaultFeatureProjection
}, options);
var updatedOptions;
if (options) {
updatedOptions = {
featureProjection: options.featureProjection,
dataProjection: options.dataProjection ?
options.dataProjection : this.defaultDataProjection,
rightHanded: options.rightHanded
};
if (options.decimals) {
updatedOptions.decimals = options.decimals;
}
}
return updatedOptions;
};

View File

@@ -42,10 +42,6 @@ ol.format.GeoJSON = function(opt_options) {
options.defaultDataProjection : 'EPSG:4326');
if (options.featureProjection) {
this.defaultFeatureProjection = ol.proj.get(options.featureProjection);
}
/**
* Name of the geometry attribute for features.
* @type {string|undefined}
@@ -357,9 +353,8 @@ ol.format.GeoJSON.prototype.getExtensions = function() {
/**
* Read a feature from a GeoJSON Feature source. Only works for Feature or
* geometry types. Use {@link ol.format.GeoJSON#readFeatures} to read
* FeatureCollection source.
* Read a feature from a GeoJSON Feature source. Only works for Feature,
* use `readFeatures` to read FeatureCollection source.
*
* @function
* @param {Document|Node|Object|string} source Source.
@@ -371,9 +366,8 @@ ol.format.GeoJSON.prototype.readFeature;
/**
* Read all features from a GeoJSON source. Works for all GeoJSON types.
* If the source includes only geometries, features will be created with those
* geometries.
* Read all features from a GeoJSON source. Works with both Feature and
* FeatureCollection sources.
*
* @function
* @param {Document|Node|Object|string} source Source.
@@ -389,23 +383,11 @@ ol.format.GeoJSON.prototype.readFeatures;
*/
ol.format.GeoJSON.prototype.readFeatureFromObject = function(
object, opt_options) {
ol.DEBUG && console.assert(object.type !== 'FeatureCollection', 'Expected a Feature or geometry');
/**
* @type {GeoJSONFeature}
*/
var geoJSONFeature = null;
if (object.type === 'Feature') {
geoJSONFeature = /** @type {GeoJSONFeature} */ (object);
} else {
geoJSONFeature = /** @type {GeoJSONFeature} */ ({
type: 'Feature',
geometry: /** @type {GeoJSONGeometry|GeoJSONGeometryCollection} */ (object)
});
}
var geometry = ol.format.GeoJSON.readGeometry_(geoJSONFeature.geometry, opt_options);
var geoJSONFeature = /** @type {GeoJSONFeature} */ (object);
ol.DEBUG && console.assert(geoJSONFeature.type == 'Feature',
'geoJSONFeature.type should be Feature');
var geometry = ol.format.GeoJSON.readGeometry_(geoJSONFeature.geometry,
opt_options);
var feature = new ol.Feature();
if (this.geometryName_) {
feature.setGeometryName(this.geometryName_);
@@ -428,8 +410,10 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(
object, opt_options) {
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
/** @type {Array.<ol.Feature>} */
var features = null;
if (geoJSONObject.type === 'FeatureCollection') {
var features;
if (geoJSONObject.type == 'Feature') {
features = [this.readFeatureFromObject(object, opt_options)];
} else if (geoJSONObject.type == 'FeatureCollection') {
var geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */
(object);
features = [];
@@ -440,9 +424,9 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(
opt_options));
}
} else {
features = [this.readFeatureFromObject(object, opt_options)];
ol.asserts.assert(false, 35); // Unknown GeoJSON object type
}
return features;
return /** Array.<ol.Feature> */ (features);
};

View File

@@ -51,10 +51,6 @@ ol.format.KML = function(opt_options) {
ol.format.XMLFeature.call(this);
if (!ol.format.KML.DEFAULT_STYLE_ARRAY_) {
ol.format.KML.createStyleDefaults_();
}
/**
* @inheritDoc
*/
@@ -65,7 +61,8 @@ ol.format.KML = function(opt_options) {
* @type {Array.<ol.style.Style>}
*/
this.defaultStyle_ = options.defaultStyle ?
options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_;
options.defaultStyle :
(ol.format.KML.DEFAULT_STYLE_ARRAY_ || ol.format.KML.createStyleDefaults_());
/**
* @private

Some files were not shown because too many files have changed in this diff Show More