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 / github-commands.md
Last active November 21, 2022 20:24
Common Github commands for work

All these commands can be followed along using this repository:

When I need to checkout a branch

I might not know the exact name of the branch, but I do know it contains some word

  • git branch --r | grep -i <pattern>

Maybe I don't have all the branches in sync with the remote repo, so I need to fetch them:

  • git fetch origin
@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"
};
}
});