Skip to content

Instantly share code, notes, and snippets.

View steveoh's full-sized avatar
🚀

steveoh steveoh

🚀
View GitHub Profile
@steveoh
steveoh / 2018devsummit.md
Last active March 19, 2018 19:16
dev summit recap

devsummit 2018

  • maturaty dev summit. not many ground breaking features. more polish
  • Machine learning and AI were big this year with the keynote being from microsoft and the introduction of a geovm in azure that can be provisioned.
  • Some cool demo's on training models to understand data and then letting them predict the future or act on other data was pretty cool.
  • https://jfkfiles2.azurewebsites.net/
  • utah roads/crash data was used in the keynote

Geocoding

  • 10.6 has a new geocoding engine but users can't create them until pro 2.2. around UC
@steveoh
steveoh / swap_code_for_value.py
Last active December 13, 2017 18:37
replaces the code for value in a new _value field
def replace_codes_with_values(feature_class, field_info, domain_info):
field_domain_map = [(field, field.domain) for field in field_info if field.domain]
fields = [field[0] for field in field_domain_map]
field_names = [field.name for field in fields]
domain_names = [domain[1] for domain in field_domain_map]
domain_lookup = {}
for name in domain_names:
domain_lookup[name] = [domain for domain in domain_info if domain.name == name][0]
@steveoh
steveoh / splitline.cs
Last active December 8, 2017 02:48
split a line based on a user click
var shape = (Polyline)row["Shape"];
var point = (MapPoint)GeometryEngine.Instance.Project(userClickGeometry, shape.SpatialReference);
var proximity = GeometryEngine.Instance.NearestPoint(shape, point);
var distance = proximity.Distance * 2;
var vertices = new List<Coordinate2D>
{
new Coordinate2D(point),
new Coordinate2D(proximity.Point),
@steveoh
steveoh / update_symbology.py
Created November 13, 2017 23:47
Update layer symbology with arcpy
import json
import arcpy
def resize_symbol(layer):
if not layer.isFeatureLayer:
return
symbology = json.loads(layer._arc_object.getsymbology())

Keybase proof

I hereby claim:

  • I am steveoh on github.
  • I am steveoh (https://keybase.io/steveoh) on keybase.
  • I have a public key whose fingerprint is E5D4 9904 BB9D 3482 A06A DE5D 2143 A56C 0A0A 53CD

To claim this, I am signing this object:

@steveoh
steveoh / getcount-comparison.py
Created June 6, 2017 15:56
compare get count vs search cursor perf
#!/usr/bin/env python
# * coding: utf8 *
'''
args.py
A module that contains sample code to get params
'''
import arcpy
import timeit
@steveoh
steveoh / args.py
Created April 3, 2017 19:17
get command line args
#!/usr/bin/env python
# * coding: utf8 *
'''
args.py
A module that contains sample code to get params
'''
import sys
@steveoh
steveoh / test.py
Created February 7, 2017 23:16
test insert and join vs in where clause
#!/usr/bin/env python
# * coding: utf8 *
'''
test.py
A module that tests inserting and joining records
'''
import arcpy
from os.path import basename
@steveoh
steveoh / fouled_up_column.py
Last active October 19, 2022 03:50
RuntimeError: A column was specified that does not exist. How to find which field
#: the fields in the feature class
actual = set([str(x.name) for x in arcpy.ListFields(r'')])
#: the fields you are trying to use
expected = set([])
fouled_up = expected - actual
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
public static class ModelStateDictionaryExtensions
{
public static IEnumerable<string> ToErrors(this ModelStateDictionary dict)
{
return dict.OrderBy(kvp => kvp.Key)