Andreas Hocevar / @ahoce
Marc Jansen / @selectoid
22. März 2017, FOSSGIS 2017, Passau
A high-performance, feature-packed library for all your mapping needs.
// Adjusted from
// https://gist.github.com/tschaub/32a5692bedac5254da24fa3b12072f35
import Map from 'ol/map';
import View from 'ol/view';
import TileLayer from 'ol/layer/tile';
import OSM from 'ol/source/osm';
import proj from 'ol/proj';
new Map({
target: 'map',
layers: [
new TileLayer({
source: new OSM()
})
],
view: new View({
center: proj.fromLonLat([13.4319466, 48.5667364]),
zoom: 14
})
});
// That's it already…
import closure from 'rollup-plugin-closure-compiler-js';
import common from 'rollup-plugin-commonjs';
import node from 'rollup-plugin-node-resolve';
module.exports = {
entry: 'main.js',
targets: [
{dest: 'bundle.js', format: 'es'}
],
plugins: [ node(), common(),
closure({
compilationLevel: 'ADVANCED',
warningLevel: 'QUIET'
})
]
};
…auf der Kommandozeile…
$ npm run build
getZoom / setZoom
Vorher
view.setZoom(1.5);
view.getZoom(); // undefined
Nachher
view.setZoom(1.5);
view.getZoom(); // 1.5 ヽ(´▽`)/ Hooray!
Details: Issue 4333, PR 5674
var geom = new ol.geom.Polygon([[
[-1, -2],
[1, -2],
[1, 2],
[-1, 2],
[-1, -2]
]]);
geom.scale(2);
geom.scale(2, 1);
geom.scale(2, 1, [-1, -2]);
Details: Issue 5684, PR 5685
Intersects
& Within
new ol.format.WFS().writeGetFeature({
srsName: 'EPSG:4326',
featureTypes: ['area'],
filter: ol.format.filter.intersects(
'the_geom',
new ol.geom.Polygon([[
[10, 20],
[10, 25],
[15, 25],
[15, 20],
[10, 20]
]])
)
});
Details: PR 5668
overlaps
& Vector / VectorTile
new ol.source.Vector({
url: 'state.geo.json',
format: new ol.format.GeoJSON(),
overlaps: false
})
Details: PR 5196
rotateWithView
Details: PR 5050
ol.interaction.Extent
(PR 5290)view.animate()
statt beforeRender
PinchZoom
& fraktionaler ZoomforEachFeatureAtPixel
etc.:
// Alt:
map.forEachFeatureAtPixel(
pixel, callback, callbackThis, layerFilterFn, layerFilterThis
);
map.hasFeatureAtPixel(
pixel, layerFilterFn, layerFilterThis
);
// Neu:
map.forEachFeatureAtPixel(pixel, callback.bind(callbackThis), {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
map.hasFeatureAtPixel(pixel, {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
Dieser Vortrag ist unter CC BY-SA lizensiert.