Compare commits
1 Commits
v6.0.0-bet
...
v6.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0381bfd6a |
@@ -27,10 +27,6 @@ jobs:
|
|||||||
name: Run Tests
|
name: Run Tests
|
||||||
command: npm test
|
command: npm test
|
||||||
|
|
||||||
- store_artifacts:
|
|
||||||
path: coverage/
|
|
||||||
destination: coverage
|
|
||||||
|
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: rendering/cases/
|
path: rendering/cases/
|
||||||
destination: rendering
|
destination: rendering
|
||||||
@@ -42,11 +38,3 @@ jobs:
|
|||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: build/examples
|
path: build/examples
|
||||||
destination: examples
|
destination: examples
|
||||||
|
|
||||||
- run:
|
|
||||||
name: Build API Docs
|
|
||||||
command: npm run apidoc
|
|
||||||
|
|
||||||
- store_artifacts:
|
|
||||||
path: build/apidoc
|
|
||||||
destination: apidoc
|
|
||||||
|
|||||||
8
.github/FUNDING.yml
vendored
@@ -1,8 +0,0 @@
|
|||||||
# These are supported funding model platforms
|
|
||||||
|
|
||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
||||||
patreon: # Replace with a single Patreon username
|
|
||||||
open_collective: openlayers
|
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
||||||
custom: # Replace with a single custom sponsorship URL
|
|
||||||
17
.github/stale.yml
vendored
@@ -1,17 +0,0 @@
|
|||||||
# Number of days of inactivity before an issue becomes stale
|
|
||||||
daysUntilStale: 60
|
|
||||||
# Number of days of inactivity before a stale issue is closed
|
|
||||||
daysUntilClose: 7
|
|
||||||
# Issues with these labels will never be considered stale
|
|
||||||
exemptLabels:
|
|
||||||
- blocker
|
|
||||||
- regression
|
|
||||||
# Label to use when marking an issue as stale
|
|
||||||
staleLabel: stale
|
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
||||||
markComment: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
||||||
closeComment: false
|
|
||||||
@@ -4,48 +4,6 @@
|
|||||||
|
|
||||||
#### Backwards incompatible changes
|
#### Backwards incompatible changes
|
||||||
|
|
||||||
#### Removal of `TOUCH` constant from `ol/has`
|
|
||||||
|
|
||||||
If you were previously using this constant, you can check if `'ontouchstart'` is defined in `window` instead.
|
|
||||||
|
|
||||||
```js
|
|
||||||
if ('ontouchstart' in window) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Removal of `GEOLOCATION` constant from `ol/has`
|
|
||||||
|
|
||||||
If you were previously using this constant, you can check if `'geolocation'` is defined in `navigator` instead.
|
|
||||||
|
|
||||||
```js
|
|
||||||
if ('geolocation' in navigator) {
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Removal of CSS print rules
|
|
||||||
|
|
||||||
The CSS media print rules were removed from the `ol.css` file. To get the previous behavior, use the following CSS:
|
|
||||||
|
|
||||||
```css
|
|
||||||
@media print {
|
|
||||||
.ol-control {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Removal of optional this arguments
|
|
||||||
|
|
||||||
The optional this (i.e. opt_this) arguments were removed from the following methods.
|
|
||||||
Please use closures, the es6 arrow function or the bind method to achieve this effect (Bind is explained here:
|
|
||||||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
|
|
||||||
|
|
||||||
* `forEachCorner` in `ol/extent`
|
|
||||||
* `LRUCache#forEach`
|
|
||||||
* `RBush#forEach` and `RBush#forEachInExtent`
|
|
||||||
|
|
||||||
##### The `setCenter`, `setZoom`, `setResolution` and `setRotation` methods on `ol/View` do not bypass constraints anymore
|
##### The `setCenter`, `setZoom`, `setResolution` and `setRotation` methods on `ol/View` do not bypass constraints anymore
|
||||||
|
|
||||||
Previously, these methods allowed setting values that were inconsistent with the given view constraints.
|
Previously, these methods allowed setting values that were inconsistent with the given view constraints.
|
||||||
@@ -64,9 +22,9 @@ Previously, this options only constrained the view *center*. This behaviour can
|
|||||||
|
|
||||||
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
|
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
|
||||||
|
|
||||||
##### The view is constrained so only one world is visible
|
##### Zoom is constrained so only one world is visible
|
||||||
|
|
||||||
Previously, maps showed multiple worlds at low zoom levels. In addition, it used to be possible to pan off the north or south edge of the world. Now, the view is restricted to show only one world, and you cannot pan off the edge. To get the previous behavior, configure the `ol/View` with `multiWorld: true`.
|
Previously, maps showed multiple worlds at low zoom levels. Now, the view is restricted to show only one world. To get the previous behavior, configure the `ol/View` with `multiWorld: true`.
|
||||||
|
|
||||||
##### Removal of deprecated methods
|
##### Removal of deprecated methods
|
||||||
|
|
||||||
@@ -130,14 +88,6 @@ If you were previously using `VectorTile` layers with `renderMode: 'vector'`, yo
|
|||||||
|
|
||||||
If you were previously using `Vector` layers with `renderMode: 'image'`, you have to remove this configuration option. Instead, use the new `ol/layer/VectorImage` layer with your `ol/source/Vector`.
|
If you were previously using `Vector` layers with `renderMode: 'image'`, you have to remove this configuration option. Instead, use the new `ol/layer/VectorImage` layer with your `ol/source/Vector`.
|
||||||
|
|
||||||
##### New declutter behavior
|
|
||||||
|
|
||||||
If a map has more than one layer with `declutter` set to true, decluttering now considers all `Vector` and `VectorTile` layers, instead of decluttering each layer separately. Only `VectorImage` layers continue to be decluttered separately. The higher the z-index of a layer, the higher the priority of its decluttered items.
|
|
||||||
|
|
||||||
Within a layer, the declutter order has changed. Previously, styles with a lower `zIndex` were prioritized over those with a higher `zIndex`. Now the opposite order is used.
|
|
||||||
|
|
||||||
On vector layers, even if decluttered images or texts have a lower z-Index than polygons or lines, they will now be rendered on top of the polygons or lines. For vector tile layers, this was the case already in previous releases.
|
|
||||||
|
|
||||||
##### New `prerender` and `postrender` layer events replace old `precompose`, `render` and `postcompose` events
|
##### New `prerender` and `postrender` layer events replace old `precompose`, `render` and `postcompose` events
|
||||||
|
|
||||||
If you were previously registering for `precompose` and `postcompose` events, you should now register for `prerender` and `postrender` events on layers. Instead of the previous `render` event, you should now listen for `postrender`. Layers are no longer composed to a single Canvas element. Instead, they are added to the map viewport as individual elements.
|
If you were previously registering for `precompose` and `postcompose` events, you should now register for `prerender` and `postrender` events on layers. Instead of the previous `render` event, you should now listen for `postrender`. Layers are no longer composed to a single Canvas element. Instead, they are added to the map viewport as individual elements.
|
||||||
|
|||||||
@@ -1,43 +1,43 @@
|
|||||||
<table><tr>
|
<table><tr>
|
||||||
<th width="33.3%">Map</th><th width="33.3%">View</th><th width="33.3%">Layers</th>
|
<th width="33.3%">Map</th><th width="33.3%">View</th><th width="33.3%">Layers</th>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><p>A <a href="module-ol_Map-Map.html">map</a> is made of <a href="module-ol_layer_Base-BaseLayer.html">layers</a>, a <a href="module-ol_View-View.html">view</a> to visualize them, <a href="module-ol_interaction_Interaction-Interaction.html">interactions</a> to modify map content and <a href="module-ol_control_Control-Control.html">controls</a> with UI components.</p>
|
<td><p>A [map](module-ol_Map-Map.html) is made of [layers](module-ol_layer_Base-BaseLayer.html), a [view](module-ol_View-View.html) to visualize them, [interactions](module-ol_interaction_Interaction-Interaction.html) to modify map content and [controls](module-ol_control_Control-Control.html) with UI components.</p>
|
||||||
<a href="module-ol_Map-Map.html">Overview</a><br>
|
[Overview](module-ol_Map-Map.html)<br>
|
||||||
<a href="module-ol_Map-Map.html#Map">Creation</a><br>
|
[Creation](module-ol_Map-Map.html#Map)<br>
|
||||||
<a href="module-ol_MapBrowserEvent-MapBrowserEvent.html">Events</a></td>
|
[Events](module-ol_MapBrowserEvent-MapBrowserEvent.html)</td>
|
||||||
<td><p>The view manages the visual parameters of the map view, like resolution or rotation.</p>
|
<td><p>The view manages the visual parameters of the map view, like resolution or rotation.</p>
|
||||||
<a href="module-ol_View-View.html">View</a> with center, projection, resolution and rotation</td>
|
[View](module-ol_View-View.html) with center, projection, resolution and rotation</td>
|
||||||
<td><p>Layers are lightweight containers that get their data from <a href="module-ol_source_Source-Source.html">sources</a>.</p>
|
<td><p>Layers are lightweight containers that get their data from [sources](module-ol_source_Source-Source.html).</p>
|
||||||
<a href="module-ol_layer_Tile-TileLayer.html">ol/layer/Tile</a><br>
|
[ol/layer/Tile](module-ol_layer_Tile-TileLayer.html)<br>
|
||||||
<a href="module-ol_layer_Image-ImageLayer.html">ol/layer/Image</a><br>
|
[ol/layer/Image](module-ol_layer_Image-ImageLayer.html)<br>
|
||||||
<a href="module-ol_layer_Vector-VectorLayer.html">ol/layer/Vector</a><br>
|
[ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html)<br>
|
||||||
<a href="module-ol_layer_VectorTile-VectorTileLayer.html">ol/layer/VectorTile</a></td>
|
[ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th>Controls</th><th>Interactions</th><th>Sources and formats</th>
|
<th>Controls</th><th>Interactions</th><th>Sources and formats</th>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a href="module-ol_control_util.html#.defaults">Map default controls</a><br>
|
<td>[Map default controls](module-ol_control_util.html#.defaults)<br>
|
||||||
<a href="module-ol_control_Control-Control.html">All controls</a>
|
[All controls](module-ol_control_Control-Control.html)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="module-ol_interaction.html#~defaults">Map default interactions</a><br>
|
[Map default interactions](module-ol_interaction.html#~defaults)<br>
|
||||||
Interactions for <a href="module-ol_Feature-Feature.html">vector features</a>
|
Interactions for [vector features](module-ol_Feature-Feature.html)
|
||||||
<ul><li><a href="module-ol_interaction_Select-Select.html">ol/interaction/Select</a></li>
|
<ul><li>[ol/interaction/Select](module-ol_interaction_Select-Select.html)</li>
|
||||||
<li><a href="module-ol_interaction_Draw-Draw.html">ol/interaction/Draw</a></li>
|
<li>[ol/interaction/Draw](module-ol_interaction_Draw-Draw.html)</li>
|
||||||
<li><a href="module-ol_interaction_Modify-Modify.html">ol/interaction/Modify</a></li></ul>
|
<li>[ol/interaction/Modify](module-ol_interaction_Modify-Modify.html)</li></ul>
|
||||||
<a href="module-ol_interaction_Interaction-Interaction.html">All interactions</a></td>
|
[All interactions](module-ol_interaction_Interaction-Interaction.html)</td>
|
||||||
<td><a href="module-ol_source_Tile-TileSource.html">Tile sources</a> for <a href="module-ol_layer_Tile-TileLayer.html">ol/layer/Tile</a>
|
<td>[Tile sources](module-ol_source_Tile-TileSource.html) for [ol/layer/Tile](module-ol_layer_Tile-TileLayer.html)
|
||||||
<br><a href="module-ol_source_Image-ImageSource.html">Image sources</a> for <a href="module-ol_layer_Image-ImageLayer.html">ol/layer/Image</a>
|
<br>[Image sources](module-ol_source_Image-ImageSource.html) for [ol/layer/Image](module-ol_layer_Image-ImageLayer.html)
|
||||||
<br><a href="module-ol_source_Vector-VectorSource.html">Vector sources</a> for <a href="module-ol_layer_Vector-VectorLayer.html">ol/layer/Vector</a>
|
<br>[Vector sources](module-ol_source_Vector-VectorSource.html) for [ol/layer/Vector](module-ol_layer_Vector-VectorLayer.html)
|
||||||
<br><a href="module-ol_source_VectorTile-VectorTile.html">Vector tile sources</a> for <a href="module-ol_layer_VectorTile-VectorTileLayer.html">ol/layer/VectorTile</a>
|
<br>[Vector tile sources](module-ol_source_VectorTile-VectorTile.html) for [ol/layer/VectorTile](module-ol_layer_VectorTile-VectorTileLayer.html)
|
||||||
<br><a href="module-ol_format_Feature-FeatureFormat.html">Formats</a> for reading/writing vector data
|
<br>[Formats](module-ol_format_Feature-FeatureFormat.html) for reading/writing vector data
|
||||||
<br><a href="module-ol_format_WMSCapabilities-WMSCapabilities.html">ol/format/WMSCapabilities</a></td></tr>
|
<br>[ol/format/WMSCapabilities](module-ol_format_WMSCapabilities-WMSCapabilities.html)</td></tr>
|
||||||
<tr><th>Projections</th><th>Observable objects</th><th>Other components</th></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 <a href="module-ol_proj.html#.transform">ol/proj#transform()</a> and <a href="module-ol_proj.html#.transformExtent">ol/proj#transformExtent()</a>.</p>
|
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol/proj#transform()](module-ol_proj.html#.transform) and [ol/proj#transformExtent()](module-ol_proj.html#.transformExtent).</p>
|
||||||
<a href="module-ol_proj.html">ol/proj</a></td>
|
[ol/proj](module-ol_proj.html)</td>
|
||||||
<td><p>Changes to all <a href="module-ol_Object-BaseObject.html">ol/Object</a>s can be observed by calling the <a href="module-ol_Object-BaseObject.html#on">object.on('propertychange')</a> method. Listeners receive an <a href="module-ol_Object-ObjectEvent.html">ol/Object.ObjectEvent</a> with information on the changed property and old value.</p>
|
<td><p>Changes to all [ol/Object](module-ol_Object-BaseObject.html)s can be observed by calling the [object.on('propertychange')](module-ol_Object-BaseObject.html#on) method. Listeners receive an [ol/Object.ObjectEvent](module-ol_Object-ObjectEvent.html) with information on the changed property and old value.</p>
|
||||||
<td>
|
<td>
|
||||||
<a href="module-ol_Geolocation.html">ol/Geolocation</a><br>
|
[ol/Geolocation](module-ol_Geolocation.html)<br>
|
||||||
<a href="module-ol_Overlay-Overlay.html">ol/Overlay</a><br></td>
|
[ol/Overlay](module-ol_Overlay-Overlay.html)<br></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ function includeAugments(doclet) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
cls._hideConstructor = true;
|
cls._hideConstructor = true;
|
||||||
if (!cls.undocumented) {
|
delete cls.undocumented;
|
||||||
cls._documented = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,9 +150,6 @@ exports.handlers = {
|
|||||||
// Remove all other undocumented symbols
|
// Remove all other undocumented symbols
|
||||||
doclet.undocumented = true;
|
doclet.undocumented = true;
|
||||||
}
|
}
|
||||||
if (doclet._documented) {
|
|
||||||
delete doclet.undocumented;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,32 @@
|
|||||||
const events = {};
|
const events = {};
|
||||||
|
const classes = {};
|
||||||
|
|
||||||
exports.handlers = {
|
exports.handlers = {
|
||||||
|
|
||||||
newDoclet: function(e) {
|
newDoclet: function(e) {
|
||||||
const doclet = e.doclet;
|
const doclet = e.doclet;
|
||||||
if (doclet.kind !== 'event') {
|
let cls;
|
||||||
return;
|
if (doclet.kind == 'event') {
|
||||||
}
|
cls = doclet.longname.split('#')[0];
|
||||||
|
|
||||||
const cls = doclet.longname.split('#')[0];
|
|
||||||
if (!(cls in events)) {
|
if (!(cls in events)) {
|
||||||
events[cls] = [];
|
events[cls] = [];
|
||||||
}
|
}
|
||||||
events[cls].push(doclet.longname);
|
events[cls].push(doclet.longname);
|
||||||
|
} else if (doclet.kind == 'class' && !(doclet.longname in classes)) {
|
||||||
|
classes[doclet.longname] = doclet;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
parseComplete: function(e) {
|
parseComplete: function(e) {
|
||||||
const doclets = e.doclets;
|
const doclets = e.doclets;
|
||||||
for (let i = 0, ii = doclets.length - 1; i < ii; ++i) {
|
let doclet, i, ii, j, jj, event, fires;
|
||||||
const doclet = doclets[i];
|
for (i = 0, ii = doclets.length - 1; i < ii; ++i) {
|
||||||
|
doclet = doclets[i];
|
||||||
if (doclet.fires) {
|
if (doclet.fires) {
|
||||||
if (doclet.kind == 'class') {
|
if (doclet.kind == 'class') {
|
||||||
const fires = [];
|
fires = [];
|
||||||
for (let j = 0, jj = doclet.fires.length; j < jj; ++j) {
|
for (j = 0, jj = doclet.fires.length; j < jj; ++j) {
|
||||||
const event = doclet.fires[j].replace('event:', '');
|
event = doclet.fires[j].replace('event:', '');
|
||||||
if (events[event]) {
|
if (events[event]) {
|
||||||
fires.push.apply(fires, events[event]);
|
fires.push.apply(fires, events[event]);
|
||||||
} else if (doclet.fires[j] !== 'event:ObjectEvent') {
|
} else if (doclet.fires[j] !== 'event:ObjectEvent') {
|
||||||
|
|||||||
@@ -214,16 +214,14 @@ function buildNav(members) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
_.each(merged, function(v) {
|
||||||
function createEntry(type, v) {
|
// exclude interfaces from sidebar
|
||||||
return {
|
if (v.interface !== true) {
|
||||||
type: type,
|
if (v.kind == 'module') {
|
||||||
|
nav.push({
|
||||||
|
type: 'module',
|
||||||
longname: v.longname,
|
longname: v.longname,
|
||||||
name: v.name,
|
name: v.name,
|
||||||
classes: find({
|
|
||||||
kind: 'class',
|
|
||||||
memberof: v.longname
|
|
||||||
}).map(createEntry.bind(this, 'class')),
|
|
||||||
members: find({
|
members: find({
|
||||||
kind: 'member',
|
kind: 'member',
|
||||||
memberof: v.longname
|
memberof: v.longname
|
||||||
@@ -240,13 +238,31 @@ function buildNav(members) {
|
|||||||
kind: 'event',
|
kind: 'event',
|
||||||
memberof: v.longname
|
memberof: v.longname
|
||||||
})
|
})
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
_.each(merged, function(v) {
|
if (v.kind == 'class') {
|
||||||
// exclude interfaces from sidebar
|
nav.push({
|
||||||
if (v.interface !== true) {
|
type: 'class',
|
||||||
if (v.kind == 'module') {
|
longname: v.longname,
|
||||||
nav.push(createEntry('module', v));
|
name: v.name,
|
||||||
|
members: find({
|
||||||
|
kind: 'member',
|
||||||
|
memberof: v.longname
|
||||||
|
}),
|
||||||
|
methods: find({
|
||||||
|
kind: 'function',
|
||||||
|
memberof: v.longname
|
||||||
|
}),
|
||||||
|
typedefs: find({
|
||||||
|
kind: 'typedef',
|
||||||
|
memberof: v.longname
|
||||||
|
}),
|
||||||
|
fires: v.fires,
|
||||||
|
events: find({
|
||||||
|
kind: 'event',
|
||||||
|
memberof: v.longname
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,18 +12,13 @@ $(function () {
|
|||||||
var $item = $(v);
|
var $item = $(v);
|
||||||
|
|
||||||
if ($item.data('name') && regexp.test($item.data('name'))) {
|
if ($item.data('name') && regexp.test($item.data('name'))) {
|
||||||
const container = $item.parent().parent().parent();
|
|
||||||
container.show();
|
|
||||||
container.closest('.itemMembers').show();
|
|
||||||
container.closest('.item').show();
|
|
||||||
$item.show();
|
$item.show();
|
||||||
$item.closest('.itemMembers').show();
|
$item.closest('.itemMembers').show();
|
||||||
$item.closest('.item').show();
|
$item.closest('.item').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$el.find('.item, .itemMembers').hide();
|
$el.find('.item, .itemMembers').show();
|
||||||
$('.navigation>ul>li').show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$el.find('.list').scrollTop(0);
|
$el.find('.list').scrollTop(0);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<sup class="variation"><?js= doc.variation ?></sup>
|
<sup class="variation"><?js= doc.variation ?></sup>
|
||||||
<?js } ?></h2>
|
<?js } ?></h2>
|
||||||
<br>
|
<br>
|
||||||
<?js if (doc.stability || doc.kind == 'namespace' || doc.kind == 'module') {
|
<?js if (doc.stability || doc.kind == 'namespace') {
|
||||||
var ancestors = doc.ancestors.map(a => a.replace(/>\./g, '>').replace(/\.</g, '<')).join('/');
|
var ancestors = doc.ancestors.map(a => a.replace(/>\./g, '>').replace(/\.</g, '<')).join('/');
|
||||||
var parts = [];
|
var parts = [];
|
||||||
if (ancestors) {
|
if (ancestors) {
|
||||||
@@ -26,21 +26,8 @@
|
|||||||
}
|
}
|
||||||
var importPath = parts.join('/');
|
var importPath = parts.join('/');
|
||||||
?>
|
?>
|
||||||
<?js
|
|
||||||
var nameParts = doc.name.split('/');
|
|
||||||
var moduleName = nameParts[nameParts.length - 1];
|
|
||||||
if(moduleName) {
|
|
||||||
var firstChar = moduleName.charAt(0);
|
|
||||||
moduleName = firstChar.toUpperCase() + moduleName.slice(1);
|
|
||||||
var isClassModule = firstChar.toUpperCase() === firstChar;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?js if (doc.kind == 'module' && !isClassModule && nameParts.length < 3) {?>
|
|
||||||
<pre class="prettyprint source"><code>import * as ol<?js= moduleName ?> from '<?js= doc.name ?>';</code></pre>
|
|
||||||
<?js } else if(doc.kind !== 'module') { ?>
|
|
||||||
<pre class="prettyprint source"><code>import <?js= doc.name ?> from '<?js= importPath ?>';</code></pre>
|
<pre class="prettyprint source"><code>import <?js= doc.name ?> from '<?js= importPath ?>';</code></pre>
|
||||||
<?js } ?>
|
<?js } ?>
|
||||||
<?js } ?>
|
|
||||||
<?js if (doc.classdesc) { ?>
|
<?js if (doc.classdesc) { ?>
|
||||||
<div class="class-description"><?js= doc.classdesc ?></div>
|
<div class="class-description"><?js= doc.classdesc ?></div>
|
||||||
<?js } ?>
|
<?js } ?>
|
||||||
@@ -156,7 +143,6 @@
|
|||||||
<h3 class="subsection-title">Methods</h3>
|
<h3 class="subsection-title">Methods</h3>
|
||||||
|
|
||||||
<dl><?js methods.forEach(function(m) { ?>
|
<dl><?js methods.forEach(function(m) { ?>
|
||||||
<?js m.parent = doc ?>
|
|
||||||
<?js= self.partial('method.tmpl', m) ?>
|
<?js= self.partial('method.tmpl', m) ?>
|
||||||
<?js }); ?></dl>
|
<?js }); ?></dl>
|
||||||
<?js } ?>
|
<?js } ?>
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ var self = this;
|
|||||||
</dt>
|
</dt>
|
||||||
<dd class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>">
|
<dd class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>">
|
||||||
|
|
||||||
<?js if (data.parent && data.parent.kind == 'module' && data.parent.name.split('ol/').length < 3) { ?>
|
|
||||||
<pre class="prettyprint source"><code>import {<?js= data.name ?>} from '<?js= data.parent.name ?>';</code></pre>
|
|
||||||
<?js } ?>
|
|
||||||
|
|
||||||
<?js if (data.description) { ?>
|
<?js if (data.description) { ?>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<?js= data.description ?>
|
<?js= data.description ?>
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ function toShortName(name) {
|
|||||||
</div>
|
</div>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<?js
|
<?js
|
||||||
let navbuilder;
|
this.nav.forEach(function (item) {
|
||||||
this.nav.forEach(navbuilder = function (item) {
|
|
||||||
?>
|
?>
|
||||||
<li class="item" data-name="<?js= item.longname ?>">
|
<li class="item" data-name="<?js= item.longname ?>">
|
||||||
<span class="title">
|
<span class="title">
|
||||||
<?js= self.linkto(item.longname, item.type === 'module' ? item.longname.replace('module:', '') : item.name) ?>
|
<?js= self.linkto(item.longname, item.longname.replace('module:', '')) ?>
|
||||||
<?js if (item.type === 'namespace' &&
|
<?js if (item.type === 'namespace' &&
|
||||||
(item.members.length + item.typedefs.length + item.methods.length +
|
(item.members.length + item.typedefs.length + item.methods.length +
|
||||||
item.events.length > 0)) { ?>
|
item.events.length > 0)) { ?>
|
||||||
@@ -23,18 +22,6 @@ function toShortName(name) {
|
|||||||
</span>
|
</span>
|
||||||
<ul class="members itemMembers">
|
<ul class="members itemMembers">
|
||||||
<?js
|
<?js
|
||||||
if (item.classes.length) {
|
|
||||||
?>
|
|
||||||
<span class="subtitle">Classes</span>
|
|
||||||
<?js
|
|
||||||
item.classes.forEach(function (v) {
|
|
||||||
navbuilder(v);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
<ul class="members itemMembers">
|
|
||||||
<?js
|
|
||||||
if (item.members.length) {
|
if (item.members.length) {
|
||||||
?>
|
?>
|
||||||
<span class="subtitle">Members</span>
|
<span class="subtitle">Members</span>
|
||||||
|
|||||||
@@ -220,19 +220,3 @@ Duplicate item added to a unique collection. For example, it may be that you tr
|
|||||||
### 59
|
### 59
|
||||||
|
|
||||||
Invalid command found in the PBF. This indicates that the loaded vector tile may be corrupt.
|
Invalid command found in the PBF. This indicates that the loaded vector tile may be corrupt.
|
||||||
|
|
||||||
### 60
|
|
||||||
|
|
||||||
Missing or invalid `size`.
|
|
||||||
|
|
||||||
### 61
|
|
||||||
|
|
||||||
Cannot determine IIIF Image API version from provided image information JSON.
|
|
||||||
|
|
||||||
### 62
|
|
||||||
|
|
||||||
A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`.
|
|
||||||
|
|
||||||
### 63
|
|
||||||
|
|
||||||
Support for the `OES_element_index_uint` WebGL extension is mandatory for WebGL layers.
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"common": false,
|
"common": false,
|
||||||
"createMapboxStreetsV6Style": false,
|
"createMapboxStreetsV6Style": false,
|
||||||
"d3": false,
|
"d3": false,
|
||||||
|
"domtoimage": false,
|
||||||
"geojsonvt": false,
|
"geojsonvt": false,
|
||||||
"GyroNorm": false,
|
"GyroNorm": false,
|
||||||
"jsPDF": false,
|
"jsPDF": false,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
|||||||
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
||||||
import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js';
|
import {Circle as CircleStyle, Fill, Stroke, Style} from '../src/ol/style.js';
|
||||||
|
|
||||||
/** @type {VectorSource<import("../src/ol/geom/SimpleGeometry.js").default>} */
|
|
||||||
const source = new VectorSource({
|
const source = new VectorSource({
|
||||||
url: 'data/geojson/switzerland.geojson',
|
url: 'data/geojson/switzerland.geojson',
|
||||||
format: new GeoJSON()
|
format: new GeoJSON()
|
||||||
@@ -52,21 +51,21 @@ const zoomtoswitzerland =
|
|||||||
document.getElementById('zoomtoswitzerland');
|
document.getElementById('zoomtoswitzerland');
|
||||||
zoomtoswitzerland.addEventListener('click', function() {
|
zoomtoswitzerland.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[0];
|
const feature = source.getFeatures()[0];
|
||||||
const polygon = feature.getGeometry();
|
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
|
||||||
view.fit(polygon, {padding: [170, 50, 30, 150]});
|
view.fit(polygon, {padding: [170, 50, 30, 150]});
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
const zoomtolausanne = document.getElementById('zoomtolausanne');
|
const zoomtolausanne = document.getElementById('zoomtolausanne');
|
||||||
zoomtolausanne.addEventListener('click', function() {
|
zoomtolausanne.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[1];
|
const feature = source.getFeatures()[1];
|
||||||
const point = feature.getGeometry();
|
const point = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
|
||||||
view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50});
|
view.fit(point, {padding: [170, 50, 30, 150], minResolution: 50});
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
const centerlausanne = document.getElementById('centerlausanne');
|
const centerlausanne = document.getElementById('centerlausanne');
|
||||||
centerlausanne.addEventListener('click', function() {
|
centerlausanne.addEventListener('click', function() {
|
||||||
const feature = source.getFeatures()[1];
|
const feature = source.getFeatures()[1];
|
||||||
const point = feature.getGeometry();
|
const point = /** @type {import("../src/ol/geom/Point.js").default} */ (feature.getGeometry());
|
||||||
const size = map.getSize();
|
const size = map.getSize();
|
||||||
view.centerOn(point.getCoordinates(), size, [570, 500]);
|
view.centerOn(point.getCoordinates(), size, [570, 500]);
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ function xyz2rgb(x) {
|
|||||||
|
|
||||||
const raster = new RasterSource({
|
const raster = new RasterSource({
|
||||||
sources: [new Stamen({
|
sources: [new Stamen({
|
||||||
layer: 'watercolor'
|
layer: 'watercolor',
|
||||||
|
transition: 0
|
||||||
})],
|
})],
|
||||||
operation: function(pixels, data) {
|
operation: function(pixels, data) {
|
||||||
const hcl = rgb2hcl(pixels[0]);
|
const hcl = rgb2hcl(pixels[0]);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ const map = new Map({
|
|||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new TileJSON({
|
source: new TileJSON({
|
||||||
url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json'
|
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure'
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
new VectorLayer({
|
new VectorLayer({
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ docs: >
|
|||||||
The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a SVG element.
|
The example loads TopoJSON geometries and uses d3 (<code>d3.geo.path</code>) to render these geometries to a SVG element.
|
||||||
tags: "d3"
|
tags: "d3"
|
||||||
resources:
|
resources:
|
||||||
- https://unpkg.com/d3@5.9.2/dist/d3.js
|
- https://unpkg.com/d3@4.12.0/build/d3.js
|
||||||
- https://unpkg.com/topojson@3.0.2/dist/topojson.js
|
- https://unpkg.com/topojson@3.0.2/dist/topojson.js
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
4
examples/d3.js
vendored
@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import {getWidth, getCenter} from '../src/ol/extent.js';
|
import {getWidth, getCenter} from '../src/ol/extent.js';
|
||||||
import {Layer, Tile as TileLayer} from '../src/ol/layer.js';
|
import {Layer, Tile as TileLayer} from '../src/ol/layer.js';
|
||||||
import SourceState from '../src/ol/source/State.js';
|
import SourceState from '../src/ol/source/State';
|
||||||
import {fromLonLat, toLonLat} from '../src/ol/proj.js';
|
import {fromLonLat, toLonLat} from '../src/ol/proj.js';
|
||||||
import Stamen from '../src/ol/source/Stamen.js';
|
import Stamen from '../src/ol/source/Stamen.js';
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ const map = new Map({
|
|||||||
/**
|
/**
|
||||||
* Load the topojson data and create an ol/layer/Image for that data.
|
* Load the topojson data and create an ol/layer/Image for that data.
|
||||||
*/
|
*/
|
||||||
d3.json('data/topojson/us.json').then(function(us) {
|
d3.json('data/topojson/us.json', function(error, us) {
|
||||||
|
|
||||||
const layer = new CanvasLayer({
|
const layer = new CanvasLayer({
|
||||||
features: topojson.feature(us, us.objects.counties)
|
features: topojson.feature(us, us.objects.counties)
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
|
|
||||||
<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<g>
|
|
||||||
<rect width="20" height="20" style="fill:#fff" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 194 B |
@@ -40,6 +40,6 @@ gn.init().then(function() {
|
|||||||
center[0] -= resolution * gamma * 25;
|
center[0] -= resolution * gamma * 25;
|
||||||
center[1] += resolution * beta * 25;
|
center[1] += resolution * beta * 25;
|
||||||
|
|
||||||
view.setCenter(center);
|
view.setCenter(view.constrainCenter(center));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
.overlay {
|
|
||||||
background-color: yellow;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 4px;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
@@ -3,13 +3,12 @@ layout: example.html
|
|||||||
title: Map Export
|
title: Map Export
|
||||||
shortdesc: Example of exporting a map as a PNG image.
|
shortdesc: Example of exporting a map as a PNG image.
|
||||||
docs: >
|
docs: >
|
||||||
Example of exporting a map as a PNG image. This example use the <a href="https://www.npmjs.com/package/html-to-image">html-to-image</a>
|
Example of exporting a map as a PNG image. This example use the <a href="https://www.npmjs.com/package/dom-to-image-more">dom-to-image-more</a>
|
||||||
library.
|
library.
|
||||||
tags: "export, png, openstreetmap"
|
tags: "export, png, openstreetmap"
|
||||||
|
resources:
|
||||||
|
- https://unpkg.com/dom-to-image-more@2.7.1/dist/dom-to-image-more.min.js
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<div style="display: none;">
|
|
||||||
<div class="overlay" id="null">Null Island</div>
|
|
||||||
</div>
|
|
||||||
<a id="export-png" class="btn btn-default"><i class="fa fa-download"></i> Download PNG</a>
|
<a id="export-png" class="btn btn-default"><i class="fa fa-download"></i> Download PNG</a>
|
||||||
<a id="image-download" download="map.png"></a>
|
<a id="image-download" download="map.png"></a>
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import Overlay from '../src/ol/Overlay.js';
|
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
||||||
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
||||||
|
|
||||||
import {toPng} from 'html-to-image';
|
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
@@ -26,23 +23,9 @@ const map = new Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
map.addOverlay(new Overlay({
|
|
||||||
position: [0, 0],
|
|
||||||
element: document.getElementById('null')
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
// export options for html-to-image.
|
|
||||||
// See: https://github.com/bubkoo/html-to-image#options
|
|
||||||
const exportOptions = {
|
|
||||||
filter: function(element) {
|
|
||||||
return element.className ? element.className.indexOf('ol-control') === -1 : true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.getElementById('export-png').addEventListener('click', function() {
|
document.getElementById('export-png').addEventListener('click', function() {
|
||||||
map.once('rendercomplete', function() {
|
map.once('rendercomplete', function() {
|
||||||
toPng(map.getTargetElement(), exportOptions)
|
domtoimage.toPng(map.getViewport().querySelector('.ol-layers'))
|
||||||
.then(function(dataURL) {
|
.then(function(dataURL) {
|
||||||
const link = document.getElementById('image-download');
|
const link = document.getElementById('image-download');
|
||||||
link.href = dataURL;
|
link.href = dataURL;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ docs: >
|
|||||||
tags: "export, pdf, openstreetmap"
|
tags: "export, pdf, openstreetmap"
|
||||||
resources:
|
resources:
|
||||||
- https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.min.js
|
- https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.min.js
|
||||||
|
- https://unpkg.com/dom-to-image-more@2.7.1/dist/dom-to-image-more.min.js
|
||||||
---
|
---
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import WKT from '../src/ol/format/WKT.js';
|
|||||||
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
||||||
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
import {OSM, Vector as VectorSource} from '../src/ol/source.js';
|
||||||
|
|
||||||
import {toJpeg} from 'html-to-image';
|
|
||||||
|
|
||||||
const raster = new TileLayer({
|
const raster = new TileLayer({
|
||||||
source: new OSM()
|
source: new OSM()
|
||||||
});
|
});
|
||||||
@@ -43,15 +41,6 @@ const dims = {
|
|||||||
a5: [210, 148]
|
a5: [210, 148]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// export options for html-to-image.
|
|
||||||
// See: https://github.com/bubkoo/html-to-image#options
|
|
||||||
const exportOptions = {
|
|
||||||
filter: function(element) {
|
|
||||||
return element.className.indexOf('ol-control') === -1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const exportButton = document.getElementById('export-pdf');
|
const exportButton = document.getElementById('export-pdf');
|
||||||
|
|
||||||
exportButton.addEventListener('click', function() {
|
exportButton.addEventListener('click', function() {
|
||||||
@@ -68,14 +57,15 @@ exportButton.addEventListener('click', function() {
|
|||||||
const extent = map.getView().calculateExtent(size);
|
const extent = map.getView().calculateExtent(size);
|
||||||
|
|
||||||
map.once('rendercomplete', function() {
|
map.once('rendercomplete', function() {
|
||||||
toJpeg(map.getTargetElement(), exportOptions).then(function(dataUrl) {
|
domtoimage.toJpeg(map.getViewport().querySelector('.ol-layers')).then(function(dataUrl) {
|
||||||
const pdf = new jsPDF('landscape', undefined, format);
|
const pdf = new jsPDF('landscape', undefined, format);
|
||||||
pdf.addImage(dataUrl, 'JPEG', 0, 0, dim[0], dim[1]);
|
pdf.addImage(dataUrl, 'JPEG', 0, 0, dim[0], dim[1]);
|
||||||
pdf.save('map.pdf');
|
pdf.save('map.pdf');
|
||||||
// Reset original map size
|
// Reset original map size
|
||||||
map.setSize(size);
|
map.setSize(size);
|
||||||
map.getView().fit(extent, {
|
map.getView().fit(extent, {
|
||||||
size: size
|
size: size,
|
||||||
|
constrainResolution: false
|
||||||
});
|
});
|
||||||
exportButton.disabled = false;
|
exportButton.disabled = false;
|
||||||
document.body.style.cursor = 'auto';
|
document.body.style.cursor = 'auto';
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import OSM from '../src/ol/source/OSM.js';
|
import OSM from '../src/ol/source/OSM.js';
|
||||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
import {defaults as defaultControls} from '../src/ol/control/util';
|
||||||
import ZoomSlider from '../src/ol/control/ZoomSlider.js';
|
import ZoomSlider from '../src/ol/control/ZoomSlider';
|
||||||
|
|
||||||
const view = new View({
|
const view = new View({
|
||||||
center: [328627.563458, 5921296.662223],
|
center: [328627.563458, 5921296.662223],
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
|
import {platformModifierKeyOnly} from '../src/ol/events/condition.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
import ExtentInteraction from '../src/ol/interaction/Extent.js';
|
import ExtentInteraction from '../src/ol/interaction/Extent.js';
|
||||||
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
|
||||||
@@ -26,7 +27,9 @@ const map = new Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
const extent = new ExtentInteraction();
|
const extent = new ExtentInteraction({
|
||||||
|
condition: platformModifierKeyOnly
|
||||||
|
});
|
||||||
map.addInteraction(extent);
|
map.addInteraction(extent);
|
||||||
extent.setActive(false);
|
extent.setActive(false);
|
||||||
|
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ const routeFeature = new Feature({
|
|||||||
type: 'route',
|
type: 'route',
|
||||||
geometry: route
|
geometry: route
|
||||||
});
|
});
|
||||||
const geoMarker = /** @type Feature<import("../src/ol/geom/Point").default> */(new Feature({
|
const geoMarker = new Feature({
|
||||||
type: 'geoMarker',
|
type: 'geoMarker',
|
||||||
geometry: new Point(routeCoords[0])
|
geometry: new Point(routeCoords[0])
|
||||||
}));
|
});
|
||||||
const startMarker = new Feature({
|
const startMarker = new Feature({
|
||||||
type: 'icon',
|
type: 'icon',
|
||||||
geometry: new Point(routeCoords[0])
|
geometry: new Point(routeCoords[0])
|
||||||
@@ -191,7 +191,7 @@ function stopAnimation(ended) {
|
|||||||
|
|
||||||
// if animation cancelled set the marker at the beginning
|
// if animation cancelled set the marker at the beginning
|
||||||
const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
|
const coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
|
||||||
const geometry = geoMarker.getGeometry();
|
const geometry = /** @type {import("../src/ol/geom/Point").default} */ (geoMarker.getGeometry());
|
||||||
geometry.setCoordinates(coord);
|
geometry.setCoordinates(coord);
|
||||||
//remove listener
|
//remove listener
|
||||||
vectorLayer.un('postrender', moveFeature);
|
vectorLayer.un('postrender', moveFeature);
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
layout: example.html
|
|
||||||
title: Filtering features with WebGL
|
|
||||||
shortdesc: Using WebGL to filter large quantities of features
|
|
||||||
docs: >
|
|
||||||
This example shows how to use `ol/renderer/webgl/PointsLayer` to dynamically filter a large amount
|
|
||||||
of point geometries. The above map is based on a dataset from the NASA containing 45k recorded meteorite
|
|
||||||
landing sites. Each meteorite is marked by a circle on the map (the bigger the circle, the heavier
|
|
||||||
the object). A pulse effect has been added, which is slightly offset by the year of the impact.
|
|
||||||
|
|
||||||
Adjusting the sliders causes the objects outside of the date range to be filtered out of the map. This is done using
|
|
||||||
a custom fragment shader on the layer renderer, and by using the `v_opacity` attribute of the rendered objects
|
|
||||||
to store the year of impact.
|
|
||||||
|
|
||||||
tags: "webgl, icon, sprite, filter, feature"
|
|
||||||
---
|
|
||||||
<div id="map" class="map"></div>
|
|
||||||
<form>
|
|
||||||
<div id="status">Show impacts between <span class="min-year"></span> and <span class="max-year"></span></div>
|
|
||||||
|
|
||||||
<label>Minimum year:</label>
|
|
||||||
<input id="min-year" type="range" min="1850" max="2015" step="1" value="1850"/>
|
|
||||||
<label>Maximum year:</label>
|
|
||||||
<input id="max-year" type="range" min="1850" max="2015" step="1" value="2015"/>
|
|
||||||
</form>
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
|
||||||
import View from '../src/ol/View.js';
|
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
|
||||||
import Feature from '../src/ol/Feature.js';
|
|
||||||
import Point from '../src/ol/geom/Point.js';
|
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
|
||||||
import {Vector} from '../src/ol/source.js';
|
|
||||||
import {fromLonLat} from '../src/ol/proj.js';
|
|
||||||
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer.js';
|
|
||||||
import {clamp, lerp} from '../src/ol/math.js';
|
|
||||||
import Stamen from '../src/ol/source/Stamen.js';
|
|
||||||
|
|
||||||
const vectorSource = new Vector({
|
|
||||||
attributions: 'NASA'
|
|
||||||
});
|
|
||||||
|
|
||||||
const oldColor = [180, 140, 140];
|
|
||||||
const newColor = [255, 80, 80];
|
|
||||||
|
|
||||||
const startTime = Date.now() * 0.001;
|
|
||||||
|
|
||||||
// hanle input values & events
|
|
||||||
const minYearInput = document.getElementById('min-year');
|
|
||||||
const maxYearInput = document.getElementById('max-year');
|
|
||||||
function updateStatusText() {
|
|
||||||
const div = document.getElementById('status');
|
|
||||||
div.querySelector('span.min-year').textContent = minYearInput.value;
|
|
||||||
div.querySelector('span.max-year').textContent = maxYearInput.value;
|
|
||||||
}
|
|
||||||
minYearInput.addEventListener('input', updateStatusText);
|
|
||||||
minYearInput.addEventListener('change', updateStatusText);
|
|
||||||
maxYearInput.addEventListener('input', updateStatusText);
|
|
||||||
maxYearInput.addEventListener('change', updateStatusText);
|
|
||||||
updateStatusText();
|
|
||||||
|
|
||||||
class WebglPointsLayer extends VectorLayer {
|
|
||||||
createRenderer() {
|
|
||||||
return new WebGLPointsLayerRenderer(this, {
|
|
||||||
colorCallback: function(feature, color) {
|
|
||||||
// color is interpolated based on year
|
|
||||||
const ratio = clamp((feature.get('year') - 1800) / (2013 - 1800), 0, 1);
|
|
||||||
|
|
||||||
color[0] = lerp(oldColor[0], newColor[0], ratio) / 255;
|
|
||||||
color[1] = lerp(oldColor[1], newColor[1], ratio) / 255;
|
|
||||||
color[2] = lerp(oldColor[2], newColor[2], ratio) / 255;
|
|
||||||
color[3] = 1;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
},
|
|
||||||
sizeCallback: function(feature) {
|
|
||||||
return 18 * clamp(feature.get('mass') / 200000, 0, 1) + 8;
|
|
||||||
},
|
|
||||||
fragmentShader: [
|
|
||||||
'precision mediump float;',
|
|
||||||
|
|
||||||
'uniform float u_time;',
|
|
||||||
'uniform float u_minYear;',
|
|
||||||
'uniform float u_maxYear;',
|
|
||||||
|
|
||||||
'varying vec2 v_texCoord;',
|
|
||||||
'varying float v_opacity;',
|
|
||||||
'varying vec4 v_color;',
|
|
||||||
|
|
||||||
'void main(void) {',
|
|
||||||
' float impactYear = v_opacity;',
|
|
||||||
|
|
||||||
// filter out pixels if the year is outside of the given range
|
|
||||||
' if (impactYear < u_minYear || v_opacity > u_maxYear) {',
|
|
||||||
' discard;',
|
|
||||||
' }',
|
|
||||||
|
|
||||||
' vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);',
|
|
||||||
' float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;',
|
|
||||||
' float value = 2.0 * (1.0 - sqRadius);',
|
|
||||||
' float alpha = smoothstep(0.0, 1.0, value);',
|
|
||||||
|
|
||||||
' vec3 color = v_color.rgb;',
|
|
||||||
' float period = 8.0;',
|
|
||||||
' color.g *= 2.0 * (1.0 - sqrt(mod(u_time + impactYear * 0.025, period) / period));',
|
|
||||||
|
|
||||||
' gl_FragColor = vec4(color, v_color.a);',
|
|
||||||
' gl_FragColor.a *= alpha;',
|
|
||||||
' gl_FragColor.rgb *= gl_FragColor.a;',
|
|
||||||
'}'
|
|
||||||
].join(' '),
|
|
||||||
opacityCallback: function(feature) {
|
|
||||||
// here the opacity channel of the vertices is used to store the year of impact
|
|
||||||
return feature.get('year');
|
|
||||||
},
|
|
||||||
uniforms: {
|
|
||||||
u_time: function() {
|
|
||||||
return Date.now() * 0.001 - startTime;
|
|
||||||
},
|
|
||||||
u_minYear: function() {
|
|
||||||
return parseInt(minYearInput.value);
|
|
||||||
},
|
|
||||||
u_maxYear: function() {
|
|
||||||
return parseInt(maxYearInput.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function loadData() {
|
|
||||||
const client = new XMLHttpRequest();
|
|
||||||
client.open('GET', 'data/csv/meteorite_landings.csv');
|
|
||||||
client.onload = function() {
|
|
||||||
const csv = client.responseText;
|
|
||||||
const features = [];
|
|
||||||
|
|
||||||
let prevIndex = csv.indexOf('\n') + 1; // scan past the header line
|
|
||||||
|
|
||||||
let curIndex;
|
|
||||||
while ((curIndex = csv.indexOf('\n', prevIndex)) != -1) {
|
|
||||||
const line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
|
|
||||||
prevIndex = curIndex + 1;
|
|
||||||
|
|
||||||
const coords = fromLonLat([parseFloat(line[4]), parseFloat(line[3])]);
|
|
||||||
if (isNaN(coords[0]) || isNaN(coords[1])) {
|
|
||||||
// guard against bad data
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
features.push(new Feature({
|
|
||||||
mass: parseFloat(line[1]) || 0,
|
|
||||||
year: parseInt(line[2]) || 0,
|
|
||||||
geometry: new Point(coords)
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
vectorSource.addFeatures(features);
|
|
||||||
};
|
|
||||||
client.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
loadData();
|
|
||||||
|
|
||||||
const map = new Map({
|
|
||||||
layers: [
|
|
||||||
new TileLayer({
|
|
||||||
source: new Stamen({
|
|
||||||
layer: 'toner'
|
|
||||||
})
|
|
||||||
}),
|
|
||||||
new WebglPointsLayer({
|
|
||||||
source: vectorSource
|
|
||||||
})
|
|
||||||
],
|
|
||||||
target: document.getElementById('map'),
|
|
||||||
view: new View({
|
|
||||||
center: [0, 0],
|
|
||||||
zoom: 2
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// animate the map
|
|
||||||
function animate() {
|
|
||||||
map.render();
|
|
||||||
window.requestAnimationFrame(animate);
|
|
||||||
}
|
|
||||||
animate();
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
.map:-webkit-full-screen {
|
.map:-webkit-full-screen {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
.map:-ms-fullscreen {
|
.map:-ms-fullscreen {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
.fullscreen:-webkit-full-screen {
|
.fullscreen:-webkit-full-screen {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
.fullscreen:-ms-fullscreen {
|
.fullscreen:-ms-fullscreen {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
.map:-webkit-full-screen {
|
.map:-webkit-full-screen {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
.map:-ms-fullscreen {
|
.map:-ms-fullscreen {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import VectorTileSource from '../src/ol/source/VectorTile.js';
|
|||||||
import {Tile as TileLayer, VectorTile as VectorTileLayer} from '../src/ol/layer.js';
|
import {Tile as TileLayer, VectorTile as VectorTileLayer} from '../src/ol/layer.js';
|
||||||
import Projection from '../src/ol/proj/Projection.js';
|
import Projection from '../src/ol/proj/Projection.js';
|
||||||
|
|
||||||
// Converts geojson-vt data to GeoJSON
|
|
||||||
const replacer = function(key, value) {
|
const replacer = function(key, value) {
|
||||||
if (value.geometry) {
|
if (value.geometry) {
|
||||||
let type;
|
let type;
|
||||||
@@ -46,6 +46,11 @@ const replacer = function(key, value) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const tilePixels = new Projection({
|
||||||
|
code: 'TILE_PIXELS',
|
||||||
|
units: 'tile-pixels'
|
||||||
|
});
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
@@ -68,22 +73,23 @@ fetch(url).then(function(response) {
|
|||||||
debug: 1
|
debug: 1
|
||||||
});
|
});
|
||||||
const vectorSource = new VectorTileSource({
|
const vectorSource = new VectorTileSource({
|
||||||
format: new GeoJSON({
|
format: new GeoJSON(),
|
||||||
// Data returned from geojson-vt is in tile pixel units
|
tileLoadFunction: function(tile) {
|
||||||
dataProjection: new Projection({
|
const format = tile.getFormat();
|
||||||
code: 'TILE_PIXELS',
|
const tileCoord = tile.getTileCoord();
|
||||||
units: 'tile-pixels',
|
|
||||||
extent: [0, 0, 4096, 4096]
|
|
||||||
})
|
|
||||||
}),
|
|
||||||
tileUrlFunction: function(tileCoord) {
|
|
||||||
const data = tileIndex.getTile(tileCoord[0], tileCoord[1], tileCoord[2]);
|
const data = tileIndex.getTile(tileCoord[0], tileCoord[1], tileCoord[2]);
|
||||||
const geojson = JSON.stringify({
|
|
||||||
|
const features = format.readFeatures(
|
||||||
|
JSON.stringify({
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
features: data ? data.features : []
|
features: data ? data.features : []
|
||||||
}, replacer);
|
}, replacer));
|
||||||
return 'data:application/json;charset=UTF-8,' + geojson;
|
tile.setLoader(function() {
|
||||||
}
|
tile.setFeatures(features);
|
||||||
|
tile.setProjection(tilePixels);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction
|
||||||
});
|
});
|
||||||
const vectorLayer = new VectorTileLayer({
|
const vectorLayer = new VectorTileLayer({
|
||||||
source: vectorSource
|
source: vectorSource
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ title: Earthquakes Heatmap
|
|||||||
shortdesc: Demonstrates the use of a heatmap layer.
|
shortdesc: Demonstrates the use of a heatmap layer.
|
||||||
docs: >
|
docs: >
|
||||||
This example parses a KML file and renders the features as a <code>ol/layer/Heatmap</code> layer.
|
This example parses a KML file and renders the features as a <code>ol/layer/Heatmap</code> layer.
|
||||||
tags: "heatmap, kml, vector, style, webgl"
|
tags: "heatmap, kml, vector, style"
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<form>
|
<form>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ rome.setStyle(new Style({
|
|||||||
image: new Icon({
|
image: new Icon({
|
||||||
color: '#8959A8',
|
color: '#8959A8',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
src: 'data/square.svg'
|
src: 'data/dot.png'
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ const vectorLayer = new VectorLayer({
|
|||||||
|
|
||||||
const rasterLayer = new TileLayer({
|
const rasterLayer = new TileLayer({
|
||||||
source: new TileJSON({
|
source: new TileJSON({
|
||||||
url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
|
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure',
|
||||||
crossOrigin: ''
|
crossOrigin: ''
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,8 +13,5 @@ docs: >
|
|||||||
|
|
||||||
The dataset contains around 80k points and can be found here: https://www.kaggle.com/NUFORC/ufo-sightings
|
The dataset contains around 80k points and can be found here: https://www.kaggle.com/NUFORC/ufo-sightings
|
||||||
tags: "webgl, icon, sprite, point, ufo"
|
tags: "webgl, icon, sprite, point, ufo"
|
||||||
cloak:
|
|
||||||
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
|
||||||
value: Your Mapbox access token from https://mapbox.com/ here
|
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import TileJSON from '../src/ol/source/TileJSON.js';
|
import TileJSON from '../src/ol/source/TileJSON';
|
||||||
import Feature from '../src/ol/Feature.js';
|
import Feature from '../src/ol/Feature';
|
||||||
import Point from '../src/ol/geom/Point.js';
|
import Point from '../src/ol/geom/Point';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector';
|
||||||
import {Vector} from '../src/ol/source.js';
|
import {Vector} from '../src/ol/source';
|
||||||
import {fromLonLat} from '../src/ol/proj.js';
|
import {fromLonLat} from '../src/ol/proj';
|
||||||
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer.js';
|
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer';
|
||||||
import {lerp} from '../src/ol/math.js';
|
import {lerp} from '../src/ol/math';
|
||||||
|
|
||||||
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
|
|
||||||
|
|
||||||
|
const features = [];
|
||||||
const vectorSource = new Vector({
|
const vectorSource = new Vector({
|
||||||
features: [],
|
features: [],
|
||||||
attributions: 'National UFO Reporting Center'
|
attributions: 'National UFO Reporting Center'
|
||||||
@@ -40,17 +39,16 @@ class WebglPointsLayer extends VectorLayer {
|
|||||||
createRenderer() {
|
createRenderer() {
|
||||||
return new WebGLPointsLayerRenderer(this, {
|
return new WebGLPointsLayerRenderer(this, {
|
||||||
texture: texture,
|
texture: texture,
|
||||||
colorCallback: function(feature, color) {
|
colorCallback: function(feature, vertex, component) {
|
||||||
|
// component at index 3 is alpha
|
||||||
|
if (component === 3) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// color is interpolated based on year (min is 1910, max is 2013)
|
// color is interpolated based on year (min is 1910, max is 2013)
|
||||||
// please note: most values are between 2000-2013
|
// please note: most values are between 2000-2013
|
||||||
const ratio = (feature.get('year') - 1950) / (2013 - 1950);
|
const ratio = (feature.get('year') - 1950) / (2013 - 1950);
|
||||||
|
return lerp(oldColor[component], newColor[component], ratio * ratio) / 255;
|
||||||
color[0] = lerp(oldColor[0], newColor[0], ratio * ratio) / 255;
|
|
||||||
color[1] = lerp(oldColor[1], newColor[1], ratio * ratio) / 255;
|
|
||||||
color[2] = lerp(oldColor[2], newColor[2], ratio * ratio) / 255;
|
|
||||||
color[3] = 1;
|
|
||||||
|
|
||||||
return color;
|
|
||||||
},
|
},
|
||||||
texCoordCallback: function(feature, component) {
|
texCoordCallback: function(feature, component) {
|
||||||
let coords = shapeTextureCoords[feature.get('shape')];
|
let coords = shapeTextureCoords[feature.get('shape')];
|
||||||
@@ -72,15 +70,18 @@ function loadData() {
|
|||||||
client.open('GET', 'data/csv/ufo_sighting_data.csv');
|
client.open('GET', 'data/csv/ufo_sighting_data.csv');
|
||||||
client.onload = function() {
|
client.onload = function() {
|
||||||
const csv = client.responseText;
|
const csv = client.responseText;
|
||||||
const features = [];
|
|
||||||
|
|
||||||
let prevIndex = csv.indexOf('\n') + 1; // scan past the header line
|
|
||||||
|
|
||||||
let curIndex;
|
let curIndex;
|
||||||
while ((curIndex = csv.indexOf('\n', prevIndex)) != -1) {
|
let prevIndex = 0;
|
||||||
const line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
|
let line;
|
||||||
|
while ((curIndex = csv.indexOf('\n', prevIndex)) > 0) {
|
||||||
|
line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
|
||||||
prevIndex = curIndex + 1;
|
prevIndex = curIndex + 1;
|
||||||
|
|
||||||
|
// skip header
|
||||||
|
if (prevIndex === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const coords = fromLonLat([parseFloat(line[5]), parseFloat(line[4])]);
|
const coords = fromLonLat([parseFloat(line[5]), parseFloat(line[4])]);
|
||||||
|
|
||||||
// only keep valid points
|
// only keep valid points
|
||||||
@@ -107,7 +108,7 @@ new Map({
|
|||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new TileJSON({
|
source: new TileJSON({
|
||||||
url: 'https://api.tiles.mapbox.com/v4/mapbox.world-dark.json?access_token=' + key,
|
url: 'https://api.tiles.mapbox.com/v3/mapbox.world-dark.json?secure',
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const vectorLayer = new VectorLayer({
|
|||||||
|
|
||||||
const rasterLayer = new TileLayer({
|
const rasterLayer = new TileLayer({
|
||||||
source: new TileJSON({
|
source: new TileJSON({
|
||||||
url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
|
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure',
|
||||||
crossOrigin: ''
|
crossOrigin: ''
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
layout: example.html
|
|
||||||
title: IIIF Image API
|
|
||||||
shortdesc: Example of a IIIF Image API source.
|
|
||||||
docs: >
|
|
||||||
Example of a tile source for an International Image Interoperability Framework (IIIF) Image Service.
|
|
||||||
Try any Image API version 1 or 2 service.
|
|
||||||
tags: "IIIF, IIIF Image API, tile source"
|
|
||||||
---
|
|
||||||
<div id="map" class="map"></div>
|
|
||||||
<div class="controls">
|
|
||||||
<div id="iiif-notification"> </div>
|
|
||||||
Enter <code>info.json</code> URL:
|
|
||||||
<input type="text" id="imageInfoUrl" value="https://iiif.ub.uni-leipzig.de/iiif/j2k/0000/0107/0000010732/00000072.jpx/info.json">
|
|
||||||
<button id="display">Display image</button>
|
|
||||||
</div>
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
|
||||||
import View from '../src/ol/View.js';
|
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
|
||||||
import IIIF from '../src/ol/source/IIIF.js';
|
|
||||||
import IIIFInfo from '../src/ol/format/IIIFInfo.js';
|
|
||||||
|
|
||||||
const layer = new TileLayer(),
|
|
||||||
map = new Map({
|
|
||||||
layers: [layer],
|
|
||||||
target: 'map'
|
|
||||||
}),
|
|
||||||
notifyDiv = document.getElementById('iiif-notification'),
|
|
||||||
urlInput = document.getElementById('imageInfoUrl'),
|
|
||||||
displayButton = document.getElementById('display');
|
|
||||||
|
|
||||||
function refreshMap(imageInfoUrl) {
|
|
||||||
fetch(imageInfoUrl).then(function(response) {
|
|
||||||
response.json().then(function(imageInfo) {
|
|
||||||
const options = new IIIFInfo(imageInfo).getTileSourceOptions();
|
|
||||||
if (options === undefined || options.version === undefined) {
|
|
||||||
notifyDiv.textContent = 'Data seems to be no valid IIIF image information.';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
options.zDirection = -1;
|
|
||||||
const iiifTileSource = new IIIF(options);
|
|
||||||
layer.setSource(iiifTileSource);
|
|
||||||
map.setView(new View({
|
|
||||||
resolutions: iiifTileSource.getTileGrid().getResolutions(),
|
|
||||||
extent: iiifTileSource.getTileGrid().getExtent(),
|
|
||||||
constrainOnlyCenter: true
|
|
||||||
}));
|
|
||||||
map.getView().fit(iiifTileSource.getTileGrid().getExtent());
|
|
||||||
notifyDiv.textContent = '';
|
|
||||||
}).catch(function(body) {
|
|
||||||
notifyDiv.textContent = 'Could not read image info json. ' + body;
|
|
||||||
});
|
|
||||||
}).catch(function() {
|
|
||||||
notifyDiv.textContent = 'Could not read data from URL.';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
displayButton.addEventListener('click', function() {
|
|
||||||
refreshMap(urlInput.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
refreshMap(urlInput.value);
|
|
||||||
@@ -11,25 +11,9 @@
|
|||||||
body {
|
body {
|
||||||
padding-top: 70px;
|
padding-top: 70px;
|
||||||
}
|
}
|
||||||
img.header-logo {
|
|
||||||
padding-left: 18px;
|
|
||||||
}
|
|
||||||
input.search-query {
|
input.search-query {
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
@media (max-width: 480px) {
|
|
||||||
input.search-query {
|
|
||||||
width: 110px;
|
|
||||||
}
|
|
||||||
#count {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@media (max-width: 374px) {
|
|
||||||
input.search-query {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.example {
|
.example {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -198,9 +182,9 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<header class="navbar navbar-fixed-top" role="navigation">
|
<header class="navbar navbar-fixed-top" role="navigation">
|
||||||
<div class="container-fluid">
|
<div class="container">
|
||||||
<div class="display-table pull-left">
|
<div class="display-table pull-left">
|
||||||
<a class="navbar-brand" href="./"><img class="header-logo" src="./resources/logo-70x70.png"> OpenLayers</a>
|
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers Examples</a>
|
||||||
<form class="navbar-form" role="search">
|
<form class="navbar-form" role="search">
|
||||||
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
|
<input name="q" type="text" id="keywords" class="search-query" placeholder="Search" autofocus>
|
||||||
<span id="count"></span>
|
<span id="count"></span>
|
||||||
|
|||||||
@@ -3,13 +3,12 @@ layout: example.html
|
|||||||
title: Mapbox-gl Layer
|
title: Mapbox-gl Layer
|
||||||
shortdesc: Example of a Mapbox-gl-js layer integration.
|
shortdesc: Example of a Mapbox-gl-js layer integration.
|
||||||
docs: >
|
docs: >
|
||||||
Show how to add a mapbox-gl-js layer in an openlayers map. **Note**: Make sure to get your own API key at https://www.maptiler.com/cloud/ when using this example. No map will be visible when the API key has expired.
|
Show how to add a mapbox-gl-js layer in an openlayers map. **Note**: Make sure to get your own Mapbox API key when using this example. No map will be visible when the API key has expired.
|
||||||
tags: "simple, mapbox, vector, tiles, maptiler"
|
tags: "simple, mapbox, vector, tiles"
|
||||||
resources:
|
resources:
|
||||||
- https://unpkg.com/mapbox-gl@0.54.0/dist/mapbox-gl.js
|
- https://unpkg.com/mapbox-gl@0.51.0/dist/mapbox-gl.js
|
||||||
- https://unpkg.com/mapbox-gl@0.54.0/dist/mapbox-gl.css
|
|
||||||
cloak:
|
cloak:
|
||||||
- key: ER67WIiPdCQvhgsUjoWK
|
- key: ER67WIiPdCQvhgsUjoWK
|
||||||
value: Get your own API key at https://www.maptiler.com/cloud/
|
value: Your Mapbox access token from http://mapbox.com/ here
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
@@ -1,21 +1,50 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import Layer from '../src/ol/layer/Layer.js';
|
import Layer from '../src/ol/layer/Layer';
|
||||||
import {toLonLat, fromLonLat} from '../src/ol/proj.js';
|
import {assign} from '../src/ol/obj';
|
||||||
|
import {getTransform} from '../src/ol/proj';
|
||||||
|
import SourceState from '../src/ol/source/State';
|
||||||
import {Stroke, Style} from '../src/ol/style.js';
|
import {Stroke, Style} from '../src/ol/style.js';
|
||||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||||
import VectorSource from '../src/ol/source/Vector.js';
|
import VectorSource from '../src/ol/source/Vector.js';
|
||||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||||
|
|
||||||
const center = [-98.8, 37.9];
|
class Mapbox extends Layer {
|
||||||
const key = 'ER67WIiPdCQvhgsUjoWK';
|
|
||||||
|
|
||||||
const mbMap = new mapboxgl.Map({
|
/**
|
||||||
style: 'https://api.maptiler.com/maps/bright/style.json?key=' + key,
|
* @param {import('./Base.js').Options} options Layer options.
|
||||||
|
*/
|
||||||
|
constructor(options) {
|
||||||
|
const baseOptions = assign({}, options);
|
||||||
|
super(baseOptions);
|
||||||
|
|
||||||
|
this.baseOptions = baseOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type boolean
|
||||||
|
*/
|
||||||
|
this.loaded = false;
|
||||||
|
|
||||||
|
this.initMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
initMap() {
|
||||||
|
const map = this.map_;
|
||||||
|
const view = map.getView();
|
||||||
|
const transformToLatLng = getTransform(view.getProjection(), 'EPSG:4326');
|
||||||
|
const center = transformToLatLng(view.getCenter());
|
||||||
|
|
||||||
|
this.centerLastRender = view.getCenter();
|
||||||
|
this.zoomLastRender = view.getZoom();
|
||||||
|
this.centerLastRender = view.getCenter();
|
||||||
|
this.zoomLastRender = view.getZoom();
|
||||||
|
|
||||||
|
const options = assign(this.baseOptions, {
|
||||||
attributionControl: false,
|
attributionControl: false,
|
||||||
boxZoom: false,
|
boxZoom: false,
|
||||||
center: center,
|
center,
|
||||||
container: 'map',
|
container: map.getTargetElement(),
|
||||||
doubleClickZoom: false,
|
doubleClickZoom: false,
|
||||||
dragPan: false,
|
dragPan: false,
|
||||||
dragRotate: false,
|
dragRotate: false,
|
||||||
@@ -23,45 +52,137 @@ const mbMap = new mapboxgl.Map({
|
|||||||
keyboard: false,
|
keyboard: false,
|
||||||
pitchWithRotate: false,
|
pitchWithRotate: false,
|
||||||
scrollZoom: false,
|
scrollZoom: false,
|
||||||
touchZoomRotate: false
|
touchZoomRotate: false,
|
||||||
});
|
zoom: view.getZoom() - 1
|
||||||
|
});
|
||||||
|
|
||||||
const mbLayer = new Layer({
|
this.mbmap = new mapboxgl.Map(options);
|
||||||
render: function(frameState) {
|
this.mbmap.on('load', function() {
|
||||||
const canvas = mbMap.getCanvas();
|
this.mbmap.getCanvas().remove();
|
||||||
const viewState = frameState.viewState;
|
this.loaded = true;
|
||||||
|
this.map_.render();
|
||||||
|
[
|
||||||
|
'mapboxgl-control-container'
|
||||||
|
].forEach(className => document.getElementsByClassName(className)[0].remove());
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
const visible = mbLayer.getVisible();
|
this.mbmap.on('render', function() {
|
||||||
canvas.style.display = visible ? 'block' : 'none';
|
// Reset offset
|
||||||
|
if (this.centerNextRender) {
|
||||||
|
this.centerLastRender = this.centerNextRender;
|
||||||
|
}
|
||||||
|
if (this.zoomNextRender) {
|
||||||
|
this.zoomLastRender = this.zoomNextRender;
|
||||||
|
}
|
||||||
|
this.updateRenderedPosition([0, 0], 1);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
const opacity = mbLayer.getOpacity();
|
}
|
||||||
canvas.style.opacity = opacity;
|
|
||||||
|
|
||||||
// adjust view parameters in mapbox
|
/**
|
||||||
const rotation = viewState.rotation;
|
*
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
render(frameState) {
|
||||||
|
const map = this.map_;
|
||||||
|
const view = map.getView();
|
||||||
|
const transformToLatLng = getTransform(view.getProjection(), 'EPSG:4326');
|
||||||
|
|
||||||
|
this.centerNextRender = view.getCenter();
|
||||||
|
const lastRender = map.getPixelFromCoordinate(this.centerLastRender);
|
||||||
|
const nextRender = map.getPixelFromCoordinate(this.centerNextRender);
|
||||||
|
const centerOffset = [lastRender[0] - nextRender[0], lastRender[1] - nextRender[1]];
|
||||||
|
this.zoomNextRender = view.getZoom();
|
||||||
|
const zoomOffset = Math.pow(2, this.zoomNextRender - this.zoomLastRender);
|
||||||
|
this.updateRenderedPosition(centerOffset, zoomOffset);
|
||||||
|
|
||||||
|
const rotation = frameState.viewState.rotation;
|
||||||
if (rotation) {
|
if (rotation) {
|
||||||
mbMap.rotateTo(-rotation * 180 / Math.PI, {
|
this.mbmap.rotateTo(-rotation * 180 / Math.PI, {
|
||||||
animate: false
|
animate: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
mbMap.jumpTo({
|
|
||||||
center: toLonLat(viewState.center),
|
// Re-render mbmap
|
||||||
zoom: viewState.zoom - 1,
|
const center = transformToLatLng(this.centerNextRender);
|
||||||
animate: false
|
const zoom = view.getZoom() - 1;
|
||||||
|
this.mbmap.jumpTo({
|
||||||
|
center: center,
|
||||||
|
zoom: zoom
|
||||||
});
|
});
|
||||||
|
return this.mbmap.getCanvas();
|
||||||
// cancel the scheduled update & trigger synchronous redraw
|
|
||||||
// see https://github.com/mapbox/mapbox-gl-js/issues/7893#issue-408992184
|
|
||||||
// NOTE: THIS MIGHT BREAK WHEN UPDATING MAPBOX
|
|
||||||
if (mbMap._frame) {
|
|
||||||
mbMap._frame.cancel();
|
|
||||||
mbMap._frame = null;
|
|
||||||
}
|
}
|
||||||
mbMap._render();
|
|
||||||
|
|
||||||
return canvas;
|
updateRenderedPosition(centerOffset, zoomOffset) {
|
||||||
|
const style = this.mbmap.getCanvas().style;
|
||||||
|
style.left = Math.round(centerOffset[0]) + 'px';
|
||||||
|
style.top = Math.round(centerOffset[1]) + 'px';
|
||||||
|
style.transform = 'scale(' + zoomOffset + ')';
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
setVisible(visible) {
|
||||||
|
super.setVisible(visible);
|
||||||
|
|
||||||
|
const canvas = this.mbmap.getCanvas();
|
||||||
|
canvas.style.display = visible ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
setOpacity(opacity) {
|
||||||
|
super.setOpacity(opacity);
|
||||||
|
const canvas = this.mbmap.getCanvas();
|
||||||
|
canvas.style.opacity = opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
setZIndex(zindex) {
|
||||||
|
super.setZIndex(zindex);
|
||||||
|
const canvas = this.mbmap.getCanvas();
|
||||||
|
canvas.style.zIndex = zindex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
getSourceState() {
|
||||||
|
return this.loaded ? SourceState.READY : SourceState.UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMap(map) {
|
||||||
|
this.map_ = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mapboxgl.Map.prototype._setupContainer = function _setupContainer() {
|
||||||
|
const container = this._container;
|
||||||
|
container.classList.add('mapboxgl-map');
|
||||||
|
|
||||||
|
const canvasContainer = this._canvasContainer = container.firstChild;
|
||||||
|
|
||||||
|
this._canvas = document.createElement('canvas');
|
||||||
|
canvasContainer.insertBefore(this._canvas, canvasContainer.firstChild);
|
||||||
|
this._canvas.style.position = 'absolute';
|
||||||
|
this._canvas.addEventListener('webglcontextlost', this._contextLost, false);
|
||||||
|
this._canvas.addEventListener('webglcontextrestored', this._contextRestored, false);
|
||||||
|
this._canvas.setAttribute('tabindex', '0');
|
||||||
|
this._canvas.setAttribute('aria-label', 'Map');
|
||||||
|
this._canvas.className = 'mapboxgl-canvas';
|
||||||
|
|
||||||
|
const dimensions = this._containerDimensions();
|
||||||
|
this._resizeCanvas(dimensions[0], dimensions[1]);
|
||||||
|
|
||||||
|
this._controlContainer = canvasContainer;
|
||||||
|
const controlContainer = this._controlContainer = document.createElement('div');
|
||||||
|
controlContainer.className = 'mapboxgl-control-container';
|
||||||
|
container.appendChild(controlContainer);
|
||||||
|
|
||||||
|
const positions = this._controlPositions = {};
|
||||||
|
['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach(function(positionName) {
|
||||||
|
const elem = document.createElement('div');
|
||||||
|
elem.className = 'mapboxgl-ctrl-' + positionName;
|
||||||
|
controlContainer.appendChild(elem);
|
||||||
|
positions[positionName] = elem;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const style = new Style({
|
const style = new Style({
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
@@ -81,8 +202,21 @@ const vectorLayer = new VectorLayer({
|
|||||||
const map = new Map({
|
const map = new Map({
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new View({
|
view: new View({
|
||||||
center: fromLonLat(center),
|
center: [-10997148, 4569099],
|
||||||
zoom: 4
|
zoom: 4,
|
||||||
}),
|
minZoom: 1,
|
||||||
layers: [mbLayer, vectorLayer]
|
extent: [-Infinity, -20048966.10, Infinity, 20048966.10],
|
||||||
|
smoothExtentConstraint: false,
|
||||||
|
smoothResolutionConstraint: false
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const key = 'ER67WIiPdCQvhgsUjoWK';
|
||||||
|
const mbLayer = new Mapbox({
|
||||||
|
map: map,
|
||||||
|
container: map.getTarget(),
|
||||||
|
style: 'https://maps.tilehosting.com/styles/bright/style.json?key=' + key
|
||||||
|
});
|
||||||
|
|
||||||
|
map.addLayer(mbLayer);
|
||||||
|
map.addLayer(vectorLayer);
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
layout: example-verbatim.html
|
layout: example-verbatim.html
|
||||||
title: Vector tiles created from a Mapbox Style object
|
title: Vector tiles created from a Mapbox Style object
|
||||||
shortdesc: Example of using ol-mapbox-style with tiles from tilehosting.com.
|
shortdesc: Example of using ol-mapbox-style with tiles from tilehosting.com.
|
||||||
tags: "vector tiles, mapbox style, ol-mapbox-style, maptiler"
|
tags: "vector tiles, mapbox style, ol-mapbox-style"
|
||||||
cloak:
|
cloak:
|
||||||
- key: ER67WIiPdCQvhgsUjoWK
|
- key: lirfd6Fegsjkvs0lshxe
|
||||||
value: Get your own API key at https://www.maptiler.com/cloud/
|
value: Your API key from http://tilehosting.com/ here
|
||||||
---
|
---
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import apply from 'ol-mapbox-style';
|
import apply from 'ol-mapbox-style';
|
||||||
|
|
||||||
apply('map', 'https://api.maptiler.com/maps/topo/style.json?key=ER67WIiPdCQvhgsUjoWK');
|
apply('map', 'https://maps.tilehosting.com/styles/topo/style.json?key=ER67WIiPdCQvhgsUjoWK');
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ resources:
|
|||||||
- resources/mapbox-streets-v6-style.js
|
- resources/mapbox-streets-v6-style.js
|
||||||
cloak:
|
cloak:
|
||||||
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
|
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
|
||||||
value: Your Mapbox access token from https://mapbox.com/ here
|
value: Your Mapbox access token from http://mapbox.com/ here
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ resources:
|
|||||||
- resources/mapbox-streets-v6-style.js
|
- resources/mapbox-streets-v6-style.js
|
||||||
cloak:
|
cloak:
|
||||||
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
|
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
|
||||||
value: Your Mapbox access token from https://mapbox.com/ here
|
value: Your Mapbox access token from http://mapbox.com/ here
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import View from '../src/ol/View.js';
|
|||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer from '../src/ol/layer/Image.js';
|
||||||
import ImageMapGuide from '../src/ol/source/ImageMapGuide.js';
|
import ImageMapGuide from '../src/ol/source/ImageMapGuide.js';
|
||||||
|
|
||||||
const mdf = 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition';
|
const mdf = 'Library://Public/Samples/Sheboygan/Maps/Sheboygan.MapDefinition';
|
||||||
const agentUrl =
|
const agentUrl =
|
||||||
'http://138.197.230.93:8008/mapguide/mapagent/mapagent.fcgi?';
|
'http://www.buoyshark.com/mapguide/mapagent/mapagent.fcgi?';
|
||||||
const bounds = [
|
const bounds = [
|
||||||
-87.865114442365922,
|
-87.865114442365922,
|
||||||
43.665065564837931,
|
43.665065564837931,
|
||||||
@@ -24,9 +24,8 @@ const map = new Map({
|
|||||||
params: {
|
params: {
|
||||||
MAPDEFINITION: mdf,
|
MAPDEFINITION: mdf,
|
||||||
FORMAT: 'PNG',
|
FORMAT: 'PNG',
|
||||||
VERSION: '3.0.0',
|
USERNAME: 'OpenLayers',
|
||||||
USERNAME: 'OLGuest',
|
PASSWORD: 'OpenLayers'
|
||||||
PASSWORD: 'olguest'
|
|
||||||
},
|
},
|
||||||
ratio: 2
|
ratio: 2
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ docs: >
|
|||||||
Click on the map to get a popup. The popup is composed of a few basic elements: a container, a close button, and a place for the content. To anchor the popup to the map, an <code>ol/Overlay</code> is created with the popup container. A listener is registered for the map's <code>click</code> event to display the popup, and another listener is set as the <code>click</code> handler for the close button to hide the popup.
|
Click on the map to get a popup. The popup is composed of a few basic elements: a container, a close button, and a place for the content. To anchor the popup to the map, an <code>ol/Overlay</code> is created with the popup container. A listener is registered for the map's <code>click</code> event to display the popup, and another listener is set as the <code>click</code> handler for the close button to hide the popup.
|
||||||
</p>
|
</p>
|
||||||
tags: "overlay, popup"
|
tags: "overlay, popup"
|
||||||
cloak:
|
|
||||||
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
|
||||||
value: Your Mapbox access token from https://mapbox.com/ here
|
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<div id="popup" class="ol-popup">
|
<div id="popup" class="ol-popup">
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import TileLayer from '../src/ol/layer/Tile.js';
|
|||||||
import {toLonLat} from '../src/ol/proj.js';
|
import {toLonLat} from '../src/ol/proj.js';
|
||||||
import TileJSON from '../src/ol/source/TileJSON.js';
|
import TileJSON from '../src/ol/source/TileJSON.js';
|
||||||
|
|
||||||
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elements that make up the popup.
|
* Elements that make up the popup.
|
||||||
@@ -46,7 +45,7 @@ const map = new Map({
|
|||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new TileJSON({
|
source: new TileJSON({
|
||||||
url: 'https://api.tiles.mapbox.com/v4/mapbox.natural-earth-hypso-bathy.json?access_token=' + key,
|
url: 'https://api.tiles.mapbox.com/v3/mapbox.natural-earth-hypso-bathy.json?secure',
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ docs: >
|
|||||||
tags: "raster, pixel operation, flood"
|
tags: "raster, pixel operation, flood"
|
||||||
cloak:
|
cloak:
|
||||||
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
||||||
value: Your Mapbox access token from https://mapbox.com/ here
|
value: Your Mapbox access token from http://mapbox.com/ here
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<label>
|
<label>
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ function flood(pixels, data) {
|
|||||||
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
|
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
|
||||||
const elevation = new XYZ({
|
const elevation = new XYZ({
|
||||||
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
|
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous',
|
||||||
|
transition: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
const raster = new RasterSource({
|
const raster = new RasterSource({
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ function shade(inputs, data) {
|
|||||||
|
|
||||||
const elevation = new XYZ({
|
const elevation = new XYZ({
|
||||||
url: 'https://{a-d}.tiles.mapbox.com/v3/aj.sf-dem/{z}/{x}/{y}.png',
|
url: 'https://{a-d}.tiles.mapbox.com/v3/aj.sf-dem/{z}/{x}/{y}.png',
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous',
|
||||||
|
transition: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
const raster = new Raster({
|
const raster = new Raster({
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
<header class="navbar" role="navigation">
|
<header class="navbar" role="navigation">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="display-table pull-left" id="navbar-logo-container">
|
<div class="display-table pull-left" id="navbar-logo-container">
|
||||||
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers</a>
|
<a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers Examples</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- menu items that get hidden below 768px width -->
|
<!-- menu items that get hidden below 768px width -->
|
||||||
<nav class='collapse navbar-collapse navbar-responsive-collapse'>
|
<nav class='collapse navbar-collapse navbar-responsive-collapse'>
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
<a class="copy-button" id="copy-html-button" data-clipboard-target="#example-html-source"><i class="fa fa-clipboard"></i> Copy</a>
|
<a class="copy-button" id="copy-html-button" data-clipboard-target="#example-html-source"><i class="fa fa-clipboard"></i> Copy</a>
|
||||||
</div>
|
</div>
|
||||||
<pre><legend>index.html</legend><code id="example-html-source" class="language-markup"><!DOCTYPE html>
|
<pre><legend>index.html</legend><code id="example-html-source" class="language-markup"><!DOCTYPE html>
|
||||||
<html lang="en">
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
|
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const map = new Map({
|
|||||||
layers: [
|
layers: [
|
||||||
new TileLayer({
|
new TileLayer({
|
||||||
source: new TileJSON({
|
source: new TileJSON({
|
||||||
url: 'https://a.tiles.mapbox.com/v3/aj.1x1-degrees.json',
|
url: 'https://api.tiles.mapbox.com/v3/mapbox.geography-class.json?secure',
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ title: UTFGrid
|
|||||||
shortdesc: This example shows how to read data from a UTFGrid source.
|
shortdesc: This example shows how to read data from a UTFGrid source.
|
||||||
docs: >
|
docs: >
|
||||||
<p>Point to a country to see its name and flag.</p>
|
<p>Point to a country to see its name and flag.</p>
|
||||||
Tiles made with <a href="http://tilemill.com">TileMill</a>. Hosting on <a href="mapbox.com">mapbox.com</a> or with open-source <a href="https://github.com/klokantech/tileserver-php/">TileServer</a>.
|
Tiles made with [TileMill](http://tilemill.com). Hosting on MapBox.com or with open-source [TileServer](https://github.com/klokantech/tileserver-php/).
|
||||||
tags: "utfgrid, tilejson"
|
tags: "utfgrid, tilejson"
|
||||||
cloak:
|
cloak:
|
||||||
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
|
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
|
||||||
value: Your Mapbox access token from https://mapbox.com/ here
|
value: Your Mapbox access token from http://mapbox.com/ here
|
||||||
---
|
---
|
||||||
<div id="map" class="map"></div>
|
<div id="map" class="map"></div>
|
||||||
<div style="display: none;">
|
<div style="display: none;">
|
||||||
|
|||||||
@@ -19,25 +19,16 @@ module.exports = {
|
|||||||
context: src,
|
context: src,
|
||||||
target: 'web',
|
target: 'web',
|
||||||
entry: entry,
|
entry: entry,
|
||||||
stats: 'minimal',
|
|
||||||
module: {
|
module: {
|
||||||
rules: [{
|
rules: [{
|
||||||
test: /\.js$/,
|
|
||||||
use: {
|
use: {
|
||||||
loader: 'buble-loader'
|
loader: 'buble-loader'
|
||||||
},
|
},
|
||||||
|
test: /\.js$/,
|
||||||
include: [
|
include: [
|
||||||
path.join(__dirname, '..', '..', 'src'),
|
path.join(__dirname, '..', '..', 'src'),
|
||||||
path.join(__dirname, '..')
|
path.join(__dirname, '..')
|
||||||
]
|
]
|
||||||
}, {
|
|
||||||
test: /\.js$/,
|
|
||||||
use: {
|
|
||||||
loader: path.join(__dirname, './worker-loader.js')
|
|
||||||
},
|
|
||||||
include: [
|
|
||||||
path.join(__dirname, '../../src/ol/worker')
|
|
||||||
]
|
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
const build = require('../../tasks/serialize-workers').build;
|
|
||||||
|
|
||||||
function loader() {
|
|
||||||
const callback = this.async();
|
|
||||||
const minify = this.mode === 'production';
|
|
||||||
|
|
||||||
build(this.resource, {minify})
|
|
||||||
.then(chunk => {
|
|
||||||
for (const filePath in chunk.modules) {
|
|
||||||
this.addDependency(filePath);
|
|
||||||
}
|
|
||||||
callback(null, chunk.code);
|
|
||||||
})
|
|
||||||
.catch(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = loader;
|
|
||||||
@@ -46,7 +46,7 @@ function updateInfo() {
|
|||||||
|
|
||||||
function setTime() {
|
function setTime() {
|
||||||
startDate.setMinutes(startDate.getMinutes() + 15);
|
startDate.setMinutes(startDate.getMinutes() + 15);
|
||||||
if (startDate > new Date()) {
|
if (startDate > Date.now()) {
|
||||||
startDate = threeHoursAgo();
|
startDate = threeHoursAgo();
|
||||||
}
|
}
|
||||||
layers[1].getSource().updateParams({'TIME': startDate.toISOString()});
|
layers[1].getSource().updateParams({'TIME': startDate.toISOString()});
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
layout: example.html
|
|
||||||
title: Worker
|
|
||||||
shortdesc: This example should be deleted.
|
|
||||||
docs: >
|
|
||||||
When you move the map, a message is sent to a worker. In response, the woker sends a
|
|
||||||
message back with the version identifier.
|
|
||||||
tags: "worker"
|
|
||||||
---
|
|
||||||
<div id="map" class="map"></div>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/* eslint-disable no-console */
|
|
||||||
|
|
||||||
import Map from '../src/ol/Map.js';
|
|
||||||
import View from '../src/ol/View.js';
|
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
|
||||||
import OSM from '../src/ol/source/OSM.js';
|
|
||||||
import {create as createVersionWorker} from '../src/ol/worker/version.js';
|
|
||||||
|
|
||||||
|
|
||||||
const map = new Map({
|
|
||||||
layers: [
|
|
||||||
new TileLayer({
|
|
||||||
source: new OSM()
|
|
||||||
})
|
|
||||||
],
|
|
||||||
target: 'map',
|
|
||||||
view: new View({
|
|
||||||
center: [0, 0],
|
|
||||||
zoom: 2
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
const worker = createVersionWorker();
|
|
||||||
worker.addEventListener('error', function(error) {
|
|
||||||
console.error('worker error', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
worker.addEventListener('message', function(event) {
|
|
||||||
console.log('message from worker:', event.data);
|
|
||||||
});
|
|
||||||
|
|
||||||
map.on('moveend', function(event) {
|
|
||||||
const state = event.frameState.viewState;
|
|
||||||
worker.postMessage({zoom: state.zoom, center: state.center});
|
|
||||||
});
|
|
||||||
@@ -11,6 +11,5 @@ tags: "zoomify, deep zoom, IIP, pixel, projection"
|
|||||||
<select id="zoomifyProtocol">
|
<select id="zoomifyProtocol">
|
||||||
<option value="zoomify">Zoomify</option>
|
<option value="zoomify">Zoomify</option>
|
||||||
<option value="iip">IIP</option>
|
<option value="iip">IIP</option>
|
||||||
<option value="zoomifyretina">Zoomify Retina</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ const iipUrl = 'http://vips.vtech.fr/cgi-bin/iipsrv.fcgi?FIF=' + '/mnt/MD1/AD00/
|
|||||||
|
|
||||||
const layer = new TileLayer({
|
const layer = new TileLayer({
|
||||||
source: new Zoomify({
|
source: new Zoomify({
|
||||||
tileSize: 256,
|
|
||||||
tilePixelRatio: 1,
|
|
||||||
url: zoomifyUrl,
|
url: zoomifyUrl,
|
||||||
size: [imgWidth, imgHeight],
|
size: [imgWidth, imgHeight],
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
@@ -22,15 +20,12 @@ const layer = new TileLayer({
|
|||||||
|
|
||||||
const extent = [0, -imgHeight, imgWidth, 0];
|
const extent = [0, -imgHeight, imgWidth, 0];
|
||||||
|
|
||||||
const resolutions = layer.getSource().getTileGrid().getResolutions();
|
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
layers: [layer],
|
layers: [layer],
|
||||||
target: 'map',
|
target: 'map',
|
||||||
view: new View({
|
view: new View({
|
||||||
// adjust zoom levels to those provided by the source
|
// adjust zoom levels to those provided by the source
|
||||||
minResolution: resolutions[resolutions.length - 1],
|
resolutions: layer.getSource().getTileGrid().getResolutions(),
|
||||||
maxResolution: resolutions[0],
|
|
||||||
// constrain the center: center cannot be set outside this extent
|
// constrain the center: center cannot be set outside this extent
|
||||||
extent: extent
|
extent: extent
|
||||||
})
|
})
|
||||||
@@ -41,73 +36,17 @@ const control = document.getElementById('zoomifyProtocol');
|
|||||||
control.addEventListener('change', function(event) {
|
control.addEventListener('change', function(event) {
|
||||||
const value = event.currentTarget.value;
|
const value = event.currentTarget.value;
|
||||||
if (value === 'iip') {
|
if (value === 'iip') {
|
||||||
const extent = [0, -imgHeight, imgWidth, 0];
|
layer.setSource(new Zoomify({
|
||||||
layer.setSource(
|
|
||||||
new Zoomify({
|
|
||||||
tileSize: 256,
|
|
||||||
tilePixelRatio: 1,
|
|
||||||
url: iipUrl,
|
url: iipUrl,
|
||||||
size: [imgWidth, imgHeight],
|
size: [imgWidth, imgHeight],
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
const resolutions = layer.getSource().getTileGrid().getResolutions();
|
|
||||||
map.setView(
|
|
||||||
new View({
|
|
||||||
// adjust zoom levels to those provided by the source
|
|
||||||
minResolution: resolutions[resolutions.length - 1],
|
|
||||||
maxResolution: resolutions[0],
|
|
||||||
// constrain the center: center cannot be set outside this extent
|
|
||||||
extent: extent
|
|
||||||
})
|
|
||||||
);
|
|
||||||
map.getView().fit(extent);
|
|
||||||
} else if (value === 'zoomify') {
|
} else if (value === 'zoomify') {
|
||||||
const extent = [0, -imgHeight, imgWidth, 0];
|
layer.setSource(new Zoomify({
|
||||||
layer.setSource(
|
|
||||||
new Zoomify({
|
|
||||||
tileSize: 256,
|
|
||||||
tilePixelRatio: 1,
|
|
||||||
url: zoomifyUrl,
|
url: zoomifyUrl,
|
||||||
size: [imgWidth, imgHeight],
|
size: [imgWidth, imgHeight],
|
||||||
crossOrigin: 'anonymous'
|
crossOrigin: 'anonymous'
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
const resolutions = layer.getSource().getTileGrid().getResolutions();
|
|
||||||
map.setView(
|
|
||||||
new View({
|
|
||||||
// adjust zoom levels to those provided by the source
|
|
||||||
minResolution: resolutions[resolutions.length - 1],
|
|
||||||
maxResolution: resolutions[0],
|
|
||||||
// constrain the center: center cannot be set outside this extent
|
|
||||||
extent: extent
|
|
||||||
})
|
|
||||||
);
|
|
||||||
map.getView().fit(extent);
|
|
||||||
} else if (value === 'zoomifyretina') {
|
|
||||||
const pixelRatio = 4;
|
|
||||||
// Be careful! Image extent will be modified by pixel ratio
|
|
||||||
const extent = [0, -imgHeight / pixelRatio, imgWidth / pixelRatio, 0];
|
|
||||||
layer.setSource(
|
|
||||||
new Zoomify({
|
|
||||||
tileSize: 256 / pixelRatio,
|
|
||||||
tilePixelRatio: pixelRatio,
|
|
||||||
url: zoomifyUrl,
|
|
||||||
size: [imgWidth / pixelRatio, imgHeight / pixelRatio],
|
|
||||||
crossOrigin: 'anonymous'
|
|
||||||
})
|
|
||||||
);
|
|
||||||
const resolutions = layer.getSource().getTileGrid().getResolutions();
|
|
||||||
map.setView(
|
|
||||||
new View({
|
|
||||||
// adjust zoom levels to those provided by the source
|
|
||||||
minResolution: resolutions[resolutions.length - 1] / pixelRatio,
|
|
||||||
maxResolution: resolutions[0],
|
|
||||||
// constrain the center: center cannot be set outside this extent
|
|
||||||
extent: extent
|
|
||||||
})
|
|
||||||
);
|
|
||||||
map.getView().fit(extent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
78
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ol",
|
"name": "ol",
|
||||||
"version": "6.0.0-beta.10",
|
"version": "6.0.0-beta.4",
|
||||||
"description": "OpenLayers mapping library",
|
"description": "OpenLayers mapping library",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"map",
|
"map",
|
||||||
@@ -22,9 +22,9 @@
|
|||||||
"build-index": "npm run build-package && node tasks/generate-index",
|
"build-index": "npm run build-package && node tasks/generate-index",
|
||||||
"build-legacy": "shx rm -rf build && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css",
|
"build-legacy": "shx rm -rf build && npm run build-index && webpack --config config/webpack-config-legacy-build.js && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css",
|
||||||
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css",
|
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css",
|
||||||
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && node tasks/serialize-workers && tsc --project config/tsconfig-build.json",
|
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && tsc --project config/tsconfig-build.json",
|
||||||
"typecheck": "tsc --pretty",
|
"typecheck": "tsc --pretty",
|
||||||
"apidoc": "jsdoc -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
|
"apidoc": "jsdoc config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -38,69 +38,59 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pbf": "3.2.0",
|
"pbf": "3.2.0",
|
||||||
"pixelworks": "1.1.0",
|
"pixelworks": "1.1.0",
|
||||||
"rbush": "^3.0.0"
|
"rbush": "2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.4.0",
|
"@openlayers/eslint-plugin": "^4.0.0-beta.1",
|
||||||
"@babel/preset-env": "^7.4.4",
|
|
||||||
"@openlayers/eslint-plugin": "^4.0.0-beta.2",
|
|
||||||
"@types/arcgis-rest-api": "^10.4.4",
|
"@types/arcgis-rest-api": "^10.4.4",
|
||||||
"@types/geojson": "^7946.0.7",
|
"@types/geojson": "^7946.0.6",
|
||||||
"@types/pbf": "^3.0.1",
|
"@types/pbf": "^3.0.1",
|
||||||
|
"@types/rbush": "^2.0.2",
|
||||||
"@types/topojson-specification": "^1.0.1",
|
"@types/topojson-specification": "^1.0.1",
|
||||||
"babel-loader": "^8.0.5",
|
|
||||||
"buble": "^0.19.7",
|
"buble": "^0.19.7",
|
||||||
"buble-loader": "^0.5.1",
|
"buble-loader": "^0.5.1",
|
||||||
"chaikin-smooth": "^1.0.4",
|
"chaikin-smooth": "^1.0.4",
|
||||||
"clean-css-cli": "4.3.0",
|
"clean-css-cli": "4.2.1",
|
||||||
"copy-webpack-plugin": "^5.0.3",
|
"copy-webpack-plugin": "^5.0.1",
|
||||||
"coveralls": "3.0.4",
|
"coveralls": "3.0.3",
|
||||||
"eslint": "^6.0.0",
|
"eslint": "^5.15.2",
|
||||||
"eslint-config-openlayers": "^12.0.0",
|
"eslint-config-openlayers": "^11.0.0",
|
||||||
"expect.js": "0.3.1",
|
"expect.js": "0.3.1",
|
||||||
"front-matter": "^3.0.2",
|
"front-matter": "^3.0.1",
|
||||||
"fs-extra": "^8.0.0",
|
"fs-extra": "^7.0.1",
|
||||||
"glob": "^7.1.4",
|
"glob": "^7.1.2",
|
||||||
"globby": "^9.2.0",
|
"globby": "^9.1.0",
|
||||||
"handlebars": "4.1.2",
|
"handlebars": "4.1.1",
|
||||||
"html-to-image": "^0.1.0",
|
|
||||||
"istanbul": "0.4.5",
|
"istanbul": "0.4.5",
|
||||||
"istanbul-instrumenter-loader": "^3.0.1",
|
"jquery": "3.3.1",
|
||||||
"jquery": "3.4.1",
|
"jsdoc": "3.5.5",
|
||||||
"jsdoc": "3.6.2",
|
"jsdoc-plugin-typescript": "^1.0.7",
|
||||||
"jsdoc-plugin-typescript": "^2.0.1",
|
"karma": "^4.0.1",
|
||||||
"karma": "^4.1.0",
|
|
||||||
"karma-chrome-launcher": "2.2.0",
|
"karma-chrome-launcher": "2.2.0",
|
||||||
"karma-coverage": "^1.1.2",
|
"karma-coverage": "^1.1.2",
|
||||||
"karma-coverage-istanbul-reporter": "^2.0.5",
|
|
||||||
"karma-firefox-launcher": "^1.1.0",
|
"karma-firefox-launcher": "^1.1.0",
|
||||||
"karma-mocha": "1.3.0",
|
"karma-mocha": "1.3.0",
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-webpack": "^4.0.0-rc.2",
|
"karma-webpack": "^4.0.0-rc.2",
|
||||||
"loglevelnext": "^3.0.1",
|
"loglevelnext": "^3.0.0",
|
||||||
"marked": "0.6.2",
|
"marked": "0.6.1",
|
||||||
"mocha": "6.1.4",
|
"mocha": "6.0.2",
|
||||||
"ol-mapbox-style": "^5.0.0-beta.2",
|
"ol-mapbox-style": "^4.2.1",
|
||||||
"pixelmatch": "^5.0.0",
|
"pixelmatch": "^4.0.2",
|
||||||
"pngjs": "^3.4.0",
|
"pngjs": "^3.4.0",
|
||||||
"proj4": "2.5.0",
|
"proj4": "2.5.0",
|
||||||
"puppeteer": "~1.18.0",
|
"puppeteer": "~1.14.0",
|
||||||
"rollup": "^1.12.0",
|
"serve-static": "^1.13.2",
|
||||||
"rollup-plugin-babel": "^4.3.2",
|
|
||||||
"rollup-plugin-commonjs": "^10.0.0",
|
|
||||||
"rollup-plugin-node-resolve": "^5.0.0",
|
|
||||||
"rollup-plugin-terser": "^5.0.0",
|
|
||||||
"serve-static": "^1.14.0",
|
|
||||||
"shx": "^0.3.2",
|
"shx": "^0.3.2",
|
||||||
"sinon": "^7.3.2",
|
"sinon": "^7.2.7",
|
||||||
"terser-webpack-plugin": "^1.2.3",
|
"terser-webpack-plugin": "^1.2.3",
|
||||||
"typescript": "^3.4.5",
|
"typescript": "^3.2.2",
|
||||||
"url-polyfill": "^1.1.5",
|
"url-polyfill": "^1.1.5",
|
||||||
"walk": "^2.3.9",
|
"walk": "^2.3.9",
|
||||||
"webpack": "4.35.0",
|
"webpack": "4.29.6",
|
||||||
"webpack-cli": "^3.3.2",
|
"webpack-cli": "^3.3.0",
|
||||||
"webpack-dev-middleware": "^3.6.2",
|
"webpack-dev-middleware": "^3.6.1",
|
||||||
"webpack-dev-server": "^3.3.1",
|
"webpack-dev-server": "^3.2.1",
|
||||||
"yargs": "^13.2.2"
|
"yargs": "^13.2.2"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
@@ -1,10 +1,10 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
import XYZ from '../../../src/ol/source/XYZ';
|
||||||
import {Heatmap as HeatmapLayer} from '../../../src/ol/layer.js';
|
import {Heatmap as HeatmapLayer} from '../../../src/ol/layer';
|
||||||
import VectorSource from '../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../src/ol/source/Vector';
|
||||||
import KML from '../../../src/ol/format/KML.js';
|
import KML from '../../../src/ol/format/KML';
|
||||||
|
|
||||||
const vector = new HeatmapLayer({
|
const vector = new HeatmapLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 49 KiB |
@@ -1,30 +0,0 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
|
||||||
import View from '../../../src/ol/View.js';
|
|
||||||
import {Group as LayerGroup, Tile as TileLayer} from '../../../src/ol/layer.js';
|
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
|
||||||
|
|
||||||
new Map({
|
|
||||||
target: 'map',
|
|
||||||
view: new View({
|
|
||||||
center: [0, 0],
|
|
||||||
zoom: 3
|
|
||||||
}),
|
|
||||||
layers: new LayerGroup({
|
|
||||||
opacity: 0.75,
|
|
||||||
layers: [
|
|
||||||
new TileLayer({
|
|
||||||
opacity: 0.25,
|
|
||||||
source: new XYZ({
|
|
||||||
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg'
|
|
||||||
})
|
|
||||||
}),
|
|
||||||
new TileLayer({
|
|
||||||
source: new XYZ({
|
|
||||||
url: '/data/tiles/stamen-labels/{z}/{x}/{y}.png'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
]
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
render();
|
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
get as getProjection,
|
get as getProjection,
|
||||||
transform,
|
transform,
|
||||||
transformExtent
|
transformExtent
|
||||||
} from '../../../src/ol/proj.js';
|
} from '../../../src/ol/proj';
|
||||||
import ImageLayer from '../../../src/ol/layer/Image.js';
|
import ImageLayer from '../../../src/ol/layer/Image.js';
|
||||||
const center = transform([-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857');
|
const center = transform([-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857');
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.1 KiB |
@@ -5,9 +5,9 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||||
import {fromLonLat} from '../../../src/ol/proj.js';
|
import {fromLonLat} from '../../../src/ol/proj';
|
||||||
import {transformExtent} from '../../../src/ol/proj.js';
|
import {transformExtent} from '../../../src/ol/proj.js';
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
import XYZ from '../../../src/ol/source/XYZ';
|
||||||
|
|
||||||
const center = fromLonLat([7, 50]);
|
const center = fromLonLat([7, 50]);
|
||||||
const extent = transformExtent([2, 47, 10, 53], 'EPSG:4326', 'EPSG:3857');
|
const extent = transformExtent([2, 47, 10, 53], 'EPSG:4326', 'EPSG:3857');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
import XYZ from '../../../src/ol/source/XYZ';
|
||||||
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
||||||
|
|
||||||
const center = [-10997148, 4569099];
|
const center = [-10997148, 4569099];
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 71 KiB |
@@ -1,8 +1,8 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||||
import {fromLonLat} from '../../../src/ol/proj.js';
|
import {fromLonLat} from '../../../src/ol/proj';
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
import XYZ from '../../../src/ol/source/XYZ';
|
||||||
|
|
||||||
const center = fromLonLat([8.6, 50.1]);
|
const center = fromLonLat([8.6, 50.1]);
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
@@ -1,8 +1,8 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||||
import {fromLonLat} from '../../../src/ol/proj.js';
|
import {fromLonLat} from '../../../src/ol/proj';
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
import XYZ from '../../../src/ol/source/XYZ';
|
||||||
|
|
||||||
const center = fromLonLat([8.6, 50.1]);
|
const center = fromLonLat([8.6, 50.1]);
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 118 KiB |
@@ -1,8 +1,8 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||||
import {fromLonLat} from '../../../src/ol/proj.js';
|
import {fromLonLat} from '../../../src/ol/proj';
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
import XYZ from '../../../src/ol/source/XYZ';
|
||||||
|
|
||||||
const center = fromLonLat([8.6, 50.1]);
|
const center = fromLonLat([8.6, 50.1]);
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
@@ -1,8 +1,8 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import TileLayer from '../../../src/ol/layer/Tile.js';
|
import TileLayer from '../../../src/ol/layer/Tile.js';
|
||||||
import {fromLonLat} from '../../../src/ol/proj.js';
|
import {fromLonLat} from '../../../src/ol/proj';
|
||||||
import XYZ from '../../../src/ol/source/XYZ.js';
|
import XYZ from '../../../src/ol/source/XYZ';
|
||||||
|
|
||||||
const center = fromLonLat([8.6, 50.1]);
|
const center = fromLonLat([8.6, 50.1]);
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.6 KiB |
@@ -7,7 +7,6 @@ import Point from '../../../src/ol/geom/Point.js';
|
|||||||
import Style from '../../../src/ol/style/Style.js';
|
import Style from '../../../src/ol/style/Style.js';
|
||||||
import Text from '../../../src/ol/style/Text.js';
|
import Text from '../../../src/ol/style/Text.js';
|
||||||
import CircleStyle from '../../../src/ol/style/Circle.js';
|
import CircleStyle from '../../../src/ol/style/Circle.js';
|
||||||
import Fill from '../../../src/ol/style/Fill.js';
|
|
||||||
import Stroke from '../../../src/ol/style/Stroke.js';
|
import Stroke from '../../../src/ol/style/Stroke.js';
|
||||||
import LineString from '../../../src/ol/geom/LineString.js';
|
import LineString from '../../../src/ol/geom/LineString.js';
|
||||||
|
|
||||||
@@ -60,10 +59,9 @@ source1.addFeature(new Feature({
|
|||||||
}));
|
}));
|
||||||
layer1.setStyle(function(feature) {
|
layer1.setStyle(function(feature) {
|
||||||
return new Style({
|
return new Style({
|
||||||
zIndex: feature.get('zIndex'),
|
|
||||||
image: new CircleStyle({
|
image: new CircleStyle({
|
||||||
radius: 15,
|
radius: 15,
|
||||||
fill: new Fill({
|
stroke: new Stroke({
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -71,7 +69,7 @@ layer1.setStyle(function(feature) {
|
|||||||
});
|
});
|
||||||
map.addLayer(layer1);
|
map.addLayer(layer1);
|
||||||
|
|
||||||
center = [center[0] + 500, center[1] + 700];
|
center = [center[0] + 500, center[1] + 500];
|
||||||
const feature2 = new Feature({
|
const feature2 = new Feature({
|
||||||
geometry: new Point(center),
|
geometry: new Point(center),
|
||||||
text: 'center',
|
text: 'center',
|
||||||
@@ -90,16 +88,15 @@ source2.addFeature(new Feature({
|
|||||||
}));
|
}));
|
||||||
layer2.setStyle(function(feature) {
|
layer2.setStyle(function(feature) {
|
||||||
return new Style({
|
return new Style({
|
||||||
zIndex: feature.get('zIndex'),
|
|
||||||
text: new Text({
|
text: new Text({
|
||||||
text: feature.get('text'),
|
text: feature.get('text'),
|
||||||
font: 'italic bold 18px Ubuntu'
|
font: '16px Ubuntu'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
map.addLayer(layer2);
|
map.addLayer(layer2);
|
||||||
|
|
||||||
center = [center[0] + 500, center[1] + 300];
|
center = [center[0] + 500, center[1] + 500];
|
||||||
source3.addFeature(new Feature({
|
source3.addFeature(new Feature({
|
||||||
geometry: new Point(center),
|
geometry: new Point(center),
|
||||||
text: 'center'
|
text: 'center'
|
||||||
@@ -115,17 +112,16 @@ source3.addFeature(new Feature({
|
|||||||
layer3.setStyle(function(feature) {
|
layer3.setStyle(function(feature) {
|
||||||
return new Style({
|
return new Style({
|
||||||
image: new CircleStyle({
|
image: new CircleStyle({
|
||||||
radius: 10,
|
radius: 5,
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: 'red',
|
color: 'red'
|
||||||
width: 8
|
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
text: new Text({
|
text: new Text({
|
||||||
text: feature.get('text'),
|
text: feature.get('text'),
|
||||||
font: 'italic bold 18px Ubuntu',
|
font: '16px Ubuntu',
|
||||||
textBaseline: 'bottom',
|
textBaseline: 'bottom',
|
||||||
offsetY: -12
|
offsetY: -5
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -134,12 +130,11 @@ map.addLayer(layer3);
|
|||||||
center = [center[0] - 2000, center[1] - 2000];
|
center = [center[0] - 2000, center[1] - 2000];
|
||||||
const point = new Feature(new Point(center));
|
const point = new Feature(new Point(center));
|
||||||
point.setStyle(new Style({
|
point.setStyle(new Style({
|
||||||
zIndex: 1,
|
zIndex: 2,
|
||||||
image: new CircleStyle({
|
image: new CircleStyle({
|
||||||
radius: 8,
|
radius: 8,
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: 'blue',
|
color: 'blue'
|
||||||
width: 4
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
@@ -148,7 +143,7 @@ const line = new Feature(new LineString([
|
|||||||
[center[0] + 650, center[1] - 200]
|
[center[0] + 650, center[1] - 200]
|
||||||
]));
|
]));
|
||||||
line.setStyle(new Style({
|
line.setStyle(new Style({
|
||||||
zIndex: 2,
|
zIndex: 1,
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: '#CCC',
|
color: '#CCC',
|
||||||
width: 12
|
width: 12
|
||||||
@@ -156,7 +151,7 @@ line.setStyle(new Style({
|
|||||||
text: new Text({
|
text: new Text({
|
||||||
placement: 'line',
|
placement: 'line',
|
||||||
text: 'east-west',
|
text: 'east-west',
|
||||||
font: 'italic bold 18px Ubuntu',
|
font: '16px Ubuntu',
|
||||||
overflow: true
|
overflow: true
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
@@ -164,4 +159,4 @@ source4.addFeature(point);
|
|||||||
source4.addFeature(line);
|
source4.addFeature(line);
|
||||||
map.addLayer(layer4);
|
map.addLayer(layer4);
|
||||||
|
|
||||||
render({tolerance: 0.007});
|
render({tolerance: 0.02});
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1016 B After Width: | Height: | Size: 935 B |
@@ -42,8 +42,7 @@ const layer = new VectorLayer({
|
|||||||
const view = new View({
|
const view = new View({
|
||||||
center: [-9.5, 78],
|
center: [-9.5, 78],
|
||||||
zoom: 2,
|
zoom: 2,
|
||||||
projection: 'EPSG:4326',
|
projection: 'EPSG:4326'
|
||||||
multiWorld: true
|
|
||||||
});
|
});
|
||||||
new Map({
|
new Map({
|
||||||
pixelRatio: 1,
|
pixelRatio: 1,
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.7 KiB |
@@ -1,154 +1,55 @@
|
|||||||
|
import Feature from '../../../src/ol/Feature.js';
|
||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import VectorSource from '../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../src/ol/source/Vector.js';
|
||||||
import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
|
|
||||||
import Feature from '../../../src/ol/Feature.js';
|
|
||||||
import Point from '../../../src/ol/geom/Point.js';
|
|
||||||
import Style from '../../../src/ol/style/Style.js';
|
import Style from '../../../src/ol/style/Style.js';
|
||||||
import Text from '../../../src/ol/style/Text.js';
|
|
||||||
import CircleStyle from '../../../src/ol/style/Circle.js';
|
|
||||||
import Fill from '../../../src/ol/style/Fill.js';
|
|
||||||
import Stroke from '../../../src/ol/style/Stroke.js';
|
import Stroke from '../../../src/ol/style/Stroke.js';
|
||||||
|
import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
|
||||||
|
import CircleStyle from '../../../src/ol/style/Circle.js';
|
||||||
|
import Point from '../../../src/ol/geom/Point.js';
|
||||||
import LineString from '../../../src/ol/geom/LineString.js';
|
import LineString from '../../../src/ol/geom/LineString.js';
|
||||||
|
import Text from '../../../src/ol/style/Text.js';
|
||||||
|
|
||||||
let center = [1825927.7316762917, 6143091.089223046];
|
const center = [1825927.7316762917, 6143091.089223046];
|
||||||
const map = new Map({
|
|
||||||
pixelRatio: 1,
|
|
||||||
target: 'map',
|
|
||||||
view: new View({
|
|
||||||
center: center,
|
|
||||||
zoom: 13
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
const source1 = new VectorSource();
|
const source = new VectorSource();
|
||||||
const layer1 = new VectorImageLayer({
|
const vectorLayer1 = new VectorImageLayer({
|
||||||
declutter: true,
|
source: source,
|
||||||
source: source1
|
style: function(feature) {
|
||||||
});
|
|
||||||
|
|
||||||
const source2 = new VectorSource();
|
|
||||||
const layer2 = new VectorImageLayer({
|
|
||||||
declutter: true,
|
|
||||||
source: source2
|
|
||||||
});
|
|
||||||
|
|
||||||
const source3 = new VectorSource();
|
|
||||||
const layer3 = new VectorImageLayer({
|
|
||||||
declutter: true,
|
|
||||||
source: source3
|
|
||||||
});
|
|
||||||
|
|
||||||
const source4 = new VectorSource();
|
|
||||||
const layer4 = new VectorImageLayer({
|
|
||||||
declutter: true,
|
|
||||||
source: source4
|
|
||||||
});
|
|
||||||
|
|
||||||
const feature1 = new Feature({
|
|
||||||
geometry: new Point(center),
|
|
||||||
zIndex: 2
|
|
||||||
});
|
|
||||||
source1.addFeature(feature1);
|
|
||||||
source1.addFeature(new Feature({
|
|
||||||
geometry: new Point([center[0] - 540, center[1]]),
|
|
||||||
zIndex: 3
|
|
||||||
}));
|
|
||||||
source1.addFeature(new Feature({
|
|
||||||
geometry: new Point([center[0] + 540, center[1]]),
|
|
||||||
zIndex: 1
|
|
||||||
}));
|
|
||||||
layer1.setStyle(function(feature) {
|
|
||||||
return new Style({
|
return new Style({
|
||||||
zIndex: feature.get('zIndex'),
|
|
||||||
image: new CircleStyle({
|
image: new CircleStyle({
|
||||||
radius: 15,
|
radius: 15,
|
||||||
fill: new Fill({
|
|
||||||
color: 'blue'
|
|
||||||
})
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
map.addLayer(layer1);
|
|
||||||
|
|
||||||
center = [center[0] + 500, center[1] + 700];
|
|
||||||
const feature2 = new Feature({
|
|
||||||
geometry: new Point(center),
|
|
||||||
text: 'center',
|
|
||||||
zIndex: 2
|
|
||||||
});
|
|
||||||
source2.addFeature(feature2);
|
|
||||||
source2.addFeature(new Feature({
|
|
||||||
geometry: new Point([center[0] - 540, center[1]]),
|
|
||||||
text: 'west',
|
|
||||||
zIndex: 3
|
|
||||||
}));
|
|
||||||
source2.addFeature(new Feature({
|
|
||||||
geometry: new Point([center[0] + 540, center[1]]),
|
|
||||||
text: 'east',
|
|
||||||
zIndex: 1
|
|
||||||
}));
|
|
||||||
layer2.setStyle(function(feature) {
|
|
||||||
return new Style({
|
|
||||||
zIndex: feature.get('zIndex'),
|
|
||||||
text: new Text({
|
|
||||||
text: feature.get('text'),
|
|
||||||
font: 'italic bold 18px Ubuntu'
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
map.addLayer(layer2);
|
|
||||||
|
|
||||||
center = [center[0] + 500, center[1] + 300];
|
|
||||||
source3.addFeature(new Feature({
|
|
||||||
geometry: new Point(center),
|
|
||||||
text: 'center'
|
|
||||||
}));
|
|
||||||
source3.addFeature(new Feature({
|
|
||||||
geometry: new Point([center[0] - 540, center[1]]),
|
|
||||||
text: 'west'
|
|
||||||
}));
|
|
||||||
source3.addFeature(new Feature({
|
|
||||||
geometry: new Point([center[0] + 540, center[1]]),
|
|
||||||
text: 'east'
|
|
||||||
}));
|
|
||||||
layer3.setStyle(function(feature) {
|
|
||||||
return new Style({
|
|
||||||
image: new CircleStyle({
|
|
||||||
radius: 10,
|
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: 'red',
|
color: 'blue'
|
||||||
width: 8
|
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
text: new Text({
|
text: new Text({
|
||||||
text: feature.get('text'),
|
text: feature.get('text'),
|
||||||
font: 'italic bold 18px Ubuntu',
|
font: '16px Ubuntu'
|
||||||
textBaseline: 'bottom',
|
|
||||||
offsetY: -12
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
map.addLayer(layer3);
|
|
||||||
|
|
||||||
center = [center[0] - 2000, center[1] - 2000];
|
const centerFeature = new Feature({
|
||||||
const point = new Feature(new Point(center));
|
geometry: new Point(center),
|
||||||
point.setStyle(new Style({
|
text: 'center'
|
||||||
zIndex: 1,
|
});
|
||||||
image: new CircleStyle({
|
source.addFeature(centerFeature);
|
||||||
radius: 8,
|
source.addFeature(new Feature({
|
||||||
stroke: new Stroke({
|
geometry: new Point([center[0] - 540, center[1]]),
|
||||||
color: 'blue',
|
text: 'west'
|
||||||
width: 4
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}));
|
}));
|
||||||
|
source.addFeature(new Feature({
|
||||||
|
geometry: new Point([center[0] + 540, center[1]]),
|
||||||
|
text: 'east'
|
||||||
|
}));
|
||||||
|
|
||||||
const line = new Feature(new LineString([
|
const line = new Feature(new LineString([
|
||||||
[center[0] - 650, center[1] - 200],
|
[center[0] - 650, center[1] - 200],
|
||||||
[center[0] + 650, center[1] - 200]
|
[center[0] + 650, center[1] - 200]
|
||||||
]));
|
]));
|
||||||
line.setStyle(new Style({
|
line.setStyle(new Style({
|
||||||
zIndex: 2,
|
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: '#CCC',
|
color: '#CCC',
|
||||||
width: 12
|
width: 12
|
||||||
@@ -156,12 +57,23 @@ line.setStyle(new Style({
|
|||||||
text: new Text({
|
text: new Text({
|
||||||
placement: 'line',
|
placement: 'line',
|
||||||
text: 'east-west',
|
text: 'east-west',
|
||||||
font: 'italic bold 18px Ubuntu',
|
font: '16px Ubuntu'
|
||||||
overflow: true
|
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
source4.addFeature(point);
|
source.addFeature(line);
|
||||||
source4.addFeature(line);
|
|
||||||
map.addLayer(layer4);
|
|
||||||
|
|
||||||
render({tolerance: 0.007});
|
const map = new Map({
|
||||||
|
pixelRatio: 1,
|
||||||
|
layers: [
|
||||||
|
vectorLayer1
|
||||||
|
],
|
||||||
|
target: 'map',
|
||||||
|
view: new View({
|
||||||
|
center: center,
|
||||||
|
zoom: 13
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
map.getView().fit(source.getExtent());
|
||||||
|
|
||||||
|
render({tolerance: 0.02});
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 136 KiB |
@@ -1,9 +1,9 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import VectorTileSource from '../../../src/ol/source/VectorTile.js';
|
import VectorTileSource from '../../../src/ol/source/VectorTile';
|
||||||
import MVT from '../../../src/ol/format/MVT.js';
|
import MVT from '../../../src/ol/format/MVT';
|
||||||
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
import {createXYZ} from '../../../src/ol/tilegrid';
|
||||||
import VectorTileLayer from '../../../src/ol/layer/VectorTile.js';
|
import VectorTileLayer from '../../../src/ol/layer/VectorTile';
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
pixelRatio: 2,
|
pixelRatio: 2,
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 139 KiB |
@@ -1,16 +1,16 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import VectorTileSource from '../../../src/ol/source/VectorTile.js';
|
import VectorTileSource from '../../../src/ol/source/VectorTile';
|
||||||
import MVT from '../../../src/ol/format/MVT.js';
|
import MVT from '../../../src/ol/format/MVT';
|
||||||
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
import {createXYZ} from '../../../src/ol/tilegrid';
|
||||||
import VectorTileLayer from '../../../src/ol/layer/VectorTile.js';
|
import VectorTileLayer from '../../../src/ol/layer/VectorTile';
|
||||||
import VectorSource from '../../../src/ol/source/Vector.js';
|
import VectorSource from '../../../src/ol/source/Vector';
|
||||||
import Feature from '../../../src/ol/Feature.js';
|
import Feature from '../../../src/ol/Feature';
|
||||||
import Point from '../../../src/ol/geom/Point.js';
|
import Point from '../../../src/ol/geom/Point';
|
||||||
import VectorLayer from '../../../src/ol/layer/Vector.js';
|
import VectorLayer from '../../../src/ol/layer/Vector';
|
||||||
import Style from '../../../src/ol/style/Style.js';
|
import Style from '../../../src/ol/style/Style';
|
||||||
import CircleStyle from '../../../src/ol/style/Circle.js';
|
import CircleStyle from '../../../src/ol/style/Circle';
|
||||||
import Fill from '../../../src/ol/style/Fill.js';
|
import Fill from '../../../src/ol/style/Fill';
|
||||||
|
|
||||||
const vectorSource = new VectorSource({
|
const vectorSource = new VectorSource({
|
||||||
features: [
|
features: [
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 140 KiB |
@@ -1,9 +1,9 @@
|
|||||||
import Map from '../../../src/ol/Map.js';
|
import Map from '../../../src/ol/Map.js';
|
||||||
import View from '../../../src/ol/View.js';
|
import View from '../../../src/ol/View.js';
|
||||||
import VectorTileSource from '../../../src/ol/source/VectorTile.js';
|
import VectorTileSource from '../../../src/ol/source/VectorTile';
|
||||||
import MVT from '../../../src/ol/format/MVT.js';
|
import MVT from '../../../src/ol/format/MVT';
|
||||||
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
import {createXYZ} from '../../../src/ol/tilegrid';
|
||||||
import VectorTileLayer from '../../../src/ol/layer/VectorTile.js';
|
import VectorTileLayer from '../../../src/ol/layer/VectorTile';
|
||||||
|
|
||||||
const map = new Map({
|
const map = new Map({
|
||||||
layers: [
|
layers: [
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |