Skip to content

Instantly share code, notes, and snippets.

View steveoh's full-sized avatar
🚀

steveoh steveoh

🚀
View GitHub Profile
@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 / 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 / pro-addin-version.cs
Created March 28, 2018 20:54
get the version info from a pro addin
var myDocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var arcGisProLocation = Path.Combine(myDocs, "ArcGIS", "AddIns", "ArcGISPro");
var attribute = (GuidAttribute) _assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
var proAddinFolder = $"{{{attribute.Value}}}";
var addinFolder = Path.Combine(arcGisProLocation, proAddinFolder);
if (!Directory.Exists(addinFolder))
return null;
@steveoh
steveoh / get all domains.sql
Last active March 13, 2019 16:27
get domain name/code/value from an SDE database
SELECT
cv_domain.value('DomainName[1]', 'nvarchar(50)') AS 'DomainName',
coded_value.value('Code[1]','nvarchar(50)') AS 'Code',
coded_value.value('Name[1]','nvarchar(50)') AS 'Value'
FROM
sde.GDB_ITEMS AS items INNER JOIN sde.GDB_ITEMTYPES AS itemtypes ON
items.Type = itemtypes.UUID
CROSS APPLY
items.Definition.nodes('/GPCodedValueDomain2/CodedValues/CodedValue') AS CodedValues(coded_value)
CROSS APPLY
@steveoh
steveoh / react-refactorings-map.js
Last active June 5, 2019 22:21
common react refactorings... removing duplication with `map`
export default () => {
const [active, setActive] = useState('agent');
return (
<div fluid className="filter-selector">
<ButtonGroup>
<Button color={active === 'agent' ? 'warning' : 'secondary'} onClick={() => setActive('agent')}>Agent</Button>
<Button color={active === 'offender' ? 'warning' : 'secondary'} onClick={() => setActive('offender')}>Offender</Button>
<Button color={active === 'location' ? 'warning' : 'secondary'} onClick={() => setActive('location')}>Location</Button>
<Button color={active === 'date' ? 'warning' : 'secondary'} onClick={() => setActive('date')}>Date</Button>
@steveoh
steveoh / overflow fade.css
Created June 18, 2019 16:32
fade the bottom of an element
.shorten-sm {
height: 50px;
overflow: hidden;
position: relative;
}
.shorten-sm:before {
content: '';
width: 100%;
height: 100%;
[
{
"request_count": "9590125",
"search_table": "sgid10.boundaries.municipalities"
},
{
"request_count": "9509793",
"search_table": "sgid10.location.zipplus4points"
},
{

Spatial Filters

Introduction

Create a set of spatial filters based on OGC spatial functions.

Proposal

Example Objects

@steveoh
steveoh / unused_domains.py
Last active July 11, 2020 05:33
list usused domains and fields with domain
from pprint import pprint
import arcpy
arcpy.env.workspace = r'stage.sde'
output = {}
tables = []
for dirpath, dirnames, walked_tables in arcpy.da.Walk(datatype=['FeatureClass', 'Table']):
services.AddMediatR(typeof(Startup));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(PerformanceLogger<,>));
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));
services.AddSingleton(new Lazy<NaicsProvider>(() => new NaicsProvider()));
services.AddScoped<IHasOwnership, OwnershipResolver>();
// add context for computations
services.AddDbContext<AppDbContext>(
options => options