This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate aws_lambda as lambda; | |
fn main() { | |
lambda::gateway::start(|_req /* API Gateway Request */| { | |
let res = lambda::gateway::response() // Construct API Gateway Response | |
.status(200) | |
.body(lambda::gateway::Body::from("Hello, World!"))?; // Convert String to Body | |
Ok(res) // Return response | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import View from 'ol/View' | |
import Map from 'ol/Map' | |
import TileLayer from 'ol/layer/Tile' | |
import OSM from 'ol/source/OSM' | |
import VectorLayer from 'ol/layer/Vector' | |
import VectorSource from 'ol/source/Vector' | |
import GeoJSON from 'ol/format/GeoJSON' | |
import Style from 'ol/style/Style' | |
import Fill from 'ol/style/Fill' | |
/* New import */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* New import at the top*/ | |
import { fromLonLat } from 'ol/proj' | |
// Wait for source to render | |
countriesSource.once('addfeature', () => { | |
// For each visited place | |
visitedPlaces.forEach(place => { | |
// Obtain map coordinates from longitude and latitude | |
const coordinate = fromLonLat(place) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = () => { | |
const target = document.getElementById('map') | |
// countriesSource is a variable holding the vector source with countries from countries.geojson | |
const countriesSource = new VectorSource({ | |
url: 'https://raw.githubusercontent.com/bernardobelchior/openlayers-scratch-map-tutorial/start/countries.geojson', | |
format: new GeoJSON(), | |
}) | |
new Map({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* [longitude, latitude] */ | |
const visitedPlaces = [ | |
[-0.118092, 51.509865], // London, United Kingdom | |
[-8.61099, 41.14961], // Porto, Portugal | |
[-73.935242, 40.730610], // New York, USA | |
[37.618423, 55.751244], // Moscow, Russia | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import View from 'ol/View'; | |
import Map from 'ol/Map'; | |
import TileLayer from 'ol/layer/Tile'; | |
import OSM from 'ol/source/OSM'; | |
import VectorLayer from 'ol/layer/Vector'; | |
import VectorSource from 'ol/source/Vector'; | |
import GeoJSON from 'ol/format/GeoJSON'; | |
/* New imports */ | |
import Style from 'ol/style/Style'; | |
import Fill from 'ol/style/Fill'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import View from 'ol/View'; | |
import Map from 'ol/Map'; | |
import TileLayer from 'ol/layer/Tile'; | |
import OSM from 'ol/source/OSM'; | |
/* New imports */ | |
import VectorLayer from 'ol/layer/Vector'; | |
import VectorSource from 'ol/source/Vector'; | |
import GeoJSON from 'ol/format/GeoJSON'; | |
window.onload = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import View from 'ol/View'; | |
import Map from 'ol/Map'; | |
// Wait for the page to load, otherwise getElementById may not work. | |
window.onload = () => { | |
const target = document.getElementById('map') | |
// Create a new map with the target as the div#map, and without layers - for now. | |
new Map({ | |
target, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" style="height: 100%;"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>OpenLayers Scratch Map Tutorial</title> | |
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/css/ol.css" | |
type="text/css"> | |
</head> | |
<body style="margin: 0; height: 100%"> |