Skip to content

Instantly share code, notes, and snippets.


Ghislain Prince ghisprince

View GitHub Profile
# Result is a enum of streams in any order. To get a particular stream you loop through them,
# and ask for it's type. A particular requested stream is not returned if it's not
# on the activity (need to code defensively).
streams = client.get_activity_streams(123, types=types, resolution='medium')
heartrate_stream = None
for s in streams:
ghisprince /
Created Aug 7, 2014
pretty print table's fields
import arcpy
def pprint_fields(table):
""" pretty print table's fields and their properties """
def _print(l):
print("".join(["{:>12}".format(i) for i in l]))
atts = ['name', 'aliasName', 'type', 'baseName', 'domain',
'editable', 'isNullable', 'length', 'precision',
'required', 'scale',]
for f in arcpy.ListFields(table):
ghisprince /
Last active Dec 7, 2015
Export each vertex in a line or poly fc to a csv with OID
def export_fc_to_csv(fc, out_csv):
Export each vertex in a line or poly fc to a csv with OID
user requested at
import geom_snippets
geom_snippets.export_fc_to_csv(r"c:\proj\fc1.shp", r"c:\proj\fc1.csv")
def connect_parts(fc):
Takes each part of a line feature. If made of more than one path
(aka segment, aka part) connects them into a single path.
Vertices are unchanged.
Code authored on ArcGIS ver 10.2.2
import json
with arcpy.da.UpdateCursor(fc, "Shape@JSON") as uc: