Skip to content

Instantly share code, notes, and snippets.

@bernardobelchior
Last active August 27, 2018 16:46
Show Gist options
  • Save bernardobelchior/f5d23ec2bb5228ad411632e019715706 to your computer and use it in GitHub Desktop.
Save bernardobelchior/f5d23ec2bb5228ad411632e019715706 to your computer and use it in GitHub Desktop.
OSM index.js
import View from 'ol/View';
import Map from 'ol/Map';
/* New imports */
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
window.onload = () => {
const target = document.getElementById('map')
new Map({
target,
view: new View({
center: [0, 0],
zoom: 2,
}),
layers: [
// New TileLayer with OpenStreetMap as a source
new TileLayer({
source: new OSM(),
})
]
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment