Skip to content

Instantly share code, notes, and snippets.

View RalucaNicola's full-sized avatar
🌍

Raluca Nicola RalucaNicola

🌍
View GitHub Profile
{'type': 'geojson',
'name': 'geodesign-test',
'layers': [{'name': 'geodesign-test_polygons',
'type': 'Feature Layer',
'geometryType': 'esriGeometryPolygon',
'objectIdField': 'ObjectId',
'fields': [{'name': 'project_or_policy',
'type': 'esriFieldTypeString',
'alias': 'Project or policy',
'sqlType': 'sqlTypeNVarchar',
from arcgis.gis import GIS
gis = GIS("home")
item_title = 'geodesignTest'
#upload geojson
geojson_item = gis.content.add({
'type': 'GeoJson',
'title': item_title
}, data='/arcgis/home/igcTestData/brian-repro-polygons-lines.geojson')
publish_params_khaled = {
"type": "geojson",
"name": "brian_repro",
"useBulkInserts": True,
"sourceUrl": "",
"targetSR": { "wkid": 102100, "latestWkid": 3857 },
"editorTrackingInfo": {
"enableEditorTracking": False,
"enableOwnershipAccessControl": False,
"allowOthersToQuery": True,
for new_published_layer in new_published_layers:
logger.info(
f"{new_published_layer.properties.name} - {new_published_layer.properties.geometryType}"
)
logger.info("Getting the layer manager...")
# the layer manager
test_layer_manager = new_published_layer.manager
# update layer renderer
logger.info("Update layer renderer...")
import SketchEdges3D from "esri/symbols/edges/SketchEdges3D";
import ObjectSymbol3DLayer from "esri/symbols/ObjectSymbol3DLayer";
import IconSymbol3DLayer from "esri/symbols/IconSymbol3DLayer";
import PointSymbol3D from "esri/symbols/PointSymbol3D";
import FillSymbol3DLayer from "esri/symbols/FillSymbol3DLayer";
import MeshSymbol3D from "esri/symbols/MeshSymbol3D";
import SpatialReference from "esri/geometry/SpatialReference";
import Mesh from "esri/geometry/Mesh";
import Map from "esri/Map";
import SceneView from "esri/views/SceneView";
// 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);
}
}