Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View RalucaNicola's full-sized avatar
🌍

Raluca Nicola RalucaNicola

🌍
View GitHub Profile
// to get layer id:
view.map.layers.forEach(l => console.log(l.id, l.title))
// replace the id below with the one you want to modify:
const layer = view.map.findLayerById("189b5aed56b-layer-75");
// clone renderer, modify it and set it back on the layer:
let renderer = layer.renderer.clone();
renderer.uniqueValueInfos.forEach(info=>{
// snow groomers
smoothGroomer.labelingInfo = [
new LabelClass({
labelExpressionInfo: {
expression: "$feature.name + TextFormatting.NewLine + '10.5mph'"
},
labelPlacement: "above-center",
symbol: new LabelSymbol3D({
symbolLayers: [
@RalucaNicola
RalucaNicola / main.py
Created April 19, 2022 19:49
Orbital computations
import pandas as pd
from skyfield.api import load
from datetime import timedelta
from math import isnan, pi, sqrt, atan2, sin, cos
from geojson import FeatureCollection, Feature, LineString, dump
from arcgis.gis import GIS
#constants
ts = load.timescale()
now = ts.now()
function rotate() {
if (!view.interacting) {
view.goTo({
heading: view.camera.heading + 0.1,
center: view.center
}, {animate: false});
requestAnimationFrame(rotate);
}
}
function rotate() {
if (!view.interacting) {
const camera = view.camera.clone();
camera.position.longitude -= 0.2;
view.goTo(camera, { animate: false });
requestAnimationFrame(rotate);
}
}
view.when(function () {
(function() {
const view = require("esri/views/View").views.getItemAt(0);
const p = view.camera.position;
if (p.spatialReference.isWebMercator || p.spatialReference.isWGS84) {
console.log(`
{
position: [
${p.longitude.toFixed(8)},
${p.latitude.toFixed(8)},
@RalucaNicola
RalucaNicola / set-camera.js
Created July 16, 2020 16:20
How to set a camera in ArcGIS API for JavaScript
const view = new SceneView({
container: "viewDiv",
map: map,
camera: {
heading: 90, // face due east
tilt: 45, // looking from a bird's eye view
position: {
latitude: 38,
longitude: -122,
z: 20000
sketchViewModel.on("create", function (event) {
if (event.state === "complete") {
const geometry = event.graphic.geometry;
buildingLayerView.filter = {
geometry: geometry,
spatialRelationship: "contains"
};
}
});
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
},