gis:generate_data
[Start] [Cat] [About] [Syntax] [Scraps]
Table of Contents
Generating Data
Random Date Within Range
Arcade:
var start_date = Date(1483246800000); var end_date = Date(1514782799000); var seconds = DateDiff(end_date, start_date, "seconds"); var rnd_sec = Random() * seconds; var rnd_date = DateAdd(start_date, rnd_sec, "seconds"); return rnd_date
Create Offset Time
Arcade:
var start_date = $feature.IncidentDate; var diff = Round(Random() * (3600 - 28800) + 28800,0); var newdate = DateAdd(start_date, diff, "seconds"); return newdate;
Calculate Difference From Date
var start_date ===== Sequential Numbers ===== <code> rec=0 def autoIncrement(): global rec pStart = 1 pInterval = 1 if (rec == 0): rec = pStart else: rec += pInterval return rec
autoIncrement()
Random String From List
import random def list_random(ran): return ran[random.randint(0,len(ran)-1)]
list_random(['kid', 'many', 'love', 'play'])
Random Int In Range
Arcade:
Round(Random() * (1000 - 10) + 10,0)
Python:
def randInt(rand): return rand[random.randint(20,3000)]
Incremented Numbers
Expression: autoIncrement()
Code Block:
rec=0 def autoIncrement(): global rec pStart = 1 # adjust start value, if req'd pInterval = 1 # adjust interval value, if req'd if (rec == 0): rec = pStart else: rec = rec + pInterval return rec
gis/generate_data.txt · Last modified: 2024/11/14 02:30 by 127.0.0.1