Skip to content

Instantly share code, notes, and snippets.

View tjmichael81's full-sized avatar

Timothy Michael tjmichael81

View GitHub Profile
@tjmichael81
tjmichael81 / gist:7982540
Created December 16, 2013 05:00
Export Esri geodatabase feature attachments with Python
def main():
pass
import arcpy
import os
#Script Variables
sourceAttachmentTable = r'C:\TEMP\Database.gdb\AttachmentTable__ATTACH'
targetOutputFolder = r'C:\TEMP\AttachmentExport'
filePathAttribute = 'FILE_PATH'
@tjmichael81
tjmichael81 / gist:5fb2db28a61035339a19
Created May 7, 2014 20:00
Get public IP address with Python
import urllib
import json
conn = urllib.urlopen('http://httpbin.org/ip')
print json.load(conn)['origin']
@tjmichael81
tjmichael81 / gist:b769e50dbeed15928490
Created June 10, 2015 17:37
SQL / SQL Spatial Examples from presentation by InfoGeographics
-- ----------------------------------------------------------------------------
-- 1. SQL 101
-- ----------------------------------------------------------------------------
-- 1A. SELECT RECORDS
-- ----------------------------------------------------------------------------
SELECT
*
FROM
PARCEL_TEST.DBO.PARCEL_EQ p
@tjmichael81
tjmichael81 / addFields.py
Created June 19, 2015 16:31
Add number of fields to feature class with arcpy
import arcpy
fc = r'C:\folder\database.gdb\featureClass'
# fMax = number of fields that you need to create
# fNum = starting points
fMax = 300
fNum = 1
while fNum <= fMax:
@tjmichael81
tjmichael81 / gist:e16751c49af9c195452c
Last active August 29, 2015 14:23
ArcGIS Online Home Page - Icon Font Example
<!-- Text and icon style -->
<style>
i {
color:#026893;
text-shadow: #d3d3d3 3px 5px 3px;
}
i:hover {
color: #77C144;
}
@tjmichael81
tjmichael81 / gist:e8d2f67d7a65ef5396d4
Last active August 29, 2015 14:23
ArcGIS Online Home Page - Icon Font Example (CSS Only)
<style>
i {
color:#026893;
text-shadow: #d3d3d3 3px 5px 3px;
}
i:hover {
color: #77C144;
}
@tjmichael81
tjmichael81 / gist:55d6de32336af9b6b77e
Created June 26, 2015 18:59
ArcGIS Online Home Page - Icon Font Example (Icon Example)
<td style="width:2.7in; height:80px" valign="top" width="324">
<p align="center">
<a href="http://geo-precision.net" target="blank">
<i class="fa fa-skyatlas fa-5x"></i>
</a>
</p>
<p align="center">
<span class="linkText">Visit our website</span>
</p>
</td>
@tjmichael81
tjmichael81 / gist:a7e0dca5c87c843846a9
Created June 26, 2015 19:00
ArcGIS Online Home Page - Icon Font Example (Stylesheet)
<!-- Links to external CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"></link>
@tjmichael81
tjmichael81 / printFeatures.py
Created August 28, 2015 19:41
Sort and print feature classes stored in geodatabase datasets
import arcpy
arcpy.env.workspace = r'<path_to_gdb>'
dsList = arcpy.ListDatasets()
for ds in dsList:
fcList = sorted(arcpy.ListFeatureClasses(None, None, ds))
print ('Feature Dataset: {0}\n').format(ds)
@tjmichael81
tjmichael81 / conf.xml
Last active September 25, 2015 15:23
Sample conf.xml for Esri cache creation. Includes two additional levels beyond Esri's standard ~1,128.
<?xml version="1.0" encoding="utf-8" ?>
<CacheInfo xsi:type='typens:CacheInfo' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.1'>
<TileCacheInfo xsi:type='typens:TileCacheInfo'>
<SpatialReference xsi:type='typens:ProjectedCoordinateSystem'>
<WKT>PROJCS[&quot;WGS_1984_Web_Mercator_Auxiliary_Sphere&quot;,GEOGCS[&quot;GCS_WGS_1984&quot;,DATUM[&quot;D_WGS_1984&quot;,SPHEROID[&quot;WGS_1984&quot;,6378137.0,298.257223563]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]],PROJECTION[&quot;Mercator_Auxiliary_Sphere&quot;],PARAMETER[&quot;False_Easting&quot;,0.0],PARAMETER[&quot;False_Northing&quot;,0.0],PARAMETER[&quot;Central_Meridian&quot;,0.0],PARAMETER[&quot;Standard_Parallel_1&quot;,0.0],PARAMETER[&quot;Auxiliary_Sphere_Type&quot;,0.0],UNIT[&quot;Meter&quot;,1.0],AUTHORITY[&quot;EPSG&quot;,3857]]</WKT>
<XOrigin>-20037700</XOrigin>
<YOrigin>-30241100</YOrigin>
<XYScal