Skip to content

Instantly share code, notes, and snippets.

View RalucaNicola's full-sized avatar
🌍

Raluca Nicola RalucaNicola

🌍
View GitHub Profile
const sketchLayer = new GraphicsLayer({
elevationInfo: {
mode: "on-the-ground"
}
});
webscene.add(sketchLayer);
const sketchViewModel = new SketchViewModel({
layer: sketchLayer,
view: view
const start = new Date(1900, 0, 1);
const end = new Date(2020, 0, 1);
const timeSlider = new TimeSlider({
container: "timeContainer",
mode: "cumulative-from-start",
fullTimeExtent: {
start: start,
end: end
},
esriConfig.portalUrl = "http://jsapi.maps.arcgis.com/";
const scene = new WebScene({
portalItem: {
id: "2e38f798f3124f2dae84217839cc43dc"
}
});
@RalucaNicola
RalucaNicola / index.html
Last active November 22, 2019 21:44
Prototype for elections map
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
color: #444;
}
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
#g1 {
color: #e83a66;
}
renderer.visualVariables = [
new OpacityVariable({
valueExpression: "$feature.pred_percent",
stops: [
{ value: 40, opacity: 0.3, label: "< 40%" },
{ value: 70, opacity: 1.0, label: "> 70%" }
]
}),
new SizeVariable({
valueExpression: "$feature.pred_absolute",
@RalucaNicola
RalucaNicola / elections-map-renderer.js
Last active October 18, 2019 16:13
unique value renderer
const renderer = new UniqueValueRenderer({
valueExpression: "$feature.pred_party",
defaultSymbol: createSymbol("lightgray"),
uniqueValueInfos: partyCodes.map(party => {
return {
value: party.field,
symbol: createSymbol(party.color)
}
})
});
partyCodes = [{
name: "PSD",
field: "g1",
color: "rgb(253, 127, 111)"
}, {
name: "USR PLUS",
field: "g2",
color: "rgb(0, 169, 230)"
}, {
name: "UDMR",
const electionLayer = new CSVLayer({
url: "./data/election_uat_final.csv",
copyright: "BEC, ANCPI",
title: "European Parliament Elections 2019 - Results in Romania"
});
map.add(electionLayer);
const radius = 6358137; // approximate Earth radius in meters
const origin = new Point({
x: 0, y: 0, z: -(2 * radius)
});
const oceanSurface = new Graphic({
geometry: origin,
symbol: {
type: "point-3d",