Skip to content

Instantly share code, notes, and snippets.

View stdavis's full-sized avatar

Scott Davis stdavis

View GitHub Profile
@stdavis
stdavis / EmbeddedMapLoader.js
Last active December 14, 2015 14:29
EmbeddedMapLoader.js
(function(){
var server = location.pathname.replace(/\/[^\/]+$/, "");
if (window.jasmine) {
server += '/src';
}
// var server = 'http://mapserv.utah.gov/DEQSpills';
var head = document.getElementsByTagName('head').item(0);
function loadCss(href){
@stdavis
stdavis / gist:5126925
Last active December 14, 2015 18:09
getAvailableDownloads return data for scott.sheri5@gmail.com
{
"files": [{
"fi": 1,
"fn": "12.mbtiles",
"li": 12,
"dp": "Chetek Chain (Barron) | Wisconsin",
"sz": 22361,
"ot": 1,
"pt": ["Wisconsin"]
}, {
make polygon feature layer
make point feature layer
get search cursor for polygon feature layer
loop through polygons:
select by attributes the polygon feature layer using the oid of the feature
select by location the point feature layer using the polygon feature layer
calculate field on the point feature layer equal to a value in the current polygon
done
@stdavis
stdavis / embed-demo.html
Created March 19, 2013 21:06
loadMapWithAllParams
loadMapWithAllParams = function () {
var app = new AGRCMap({
apiKey: apiKey,
UTM_X: 418502,
UTM_Y: 4519515,
countyName: 'KANE',
cityName: 'Cottonwood Heights',
addressStreet: '2832 banbury rd',
addressZone: '84121',
milepost: '300',
git clone https://github.com/agrc/AGRCJavaScriptProjectBoilerPlate.git --recursive
npm install
@stdavis
stdavis / EsriLoader.js
Last active December 16, 2015 01:39
Custom Dojo Loader Plugin for loading ESRI modules that you want the build system to ignore.
define(function () {
// summary:
// A dojo loader plugin for loading esri modules so that
// they get ignored by the build system.
return {
load: function (id, require, callback) {
// id: String
// esri module id
// require: Function
// AMD require; usually a context-sensitive require bound to the module making the plugin request
@stdavis
stdavis / gist:5629734
Created May 22, 2013 18:22
Use AGRC base maps with Leaflet
require({async: 0}); // need sync to make sure that proj4leaflet gets loaded last
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'dijit/_WidgetsInTemplateMixin',
'dojo/text!app/location/templates/VerifyMap.html',
'dojo/topic',
'leaflet/proj4js-compressed',
@stdavis
stdavis / build.sh
Created June 3, 2013 13:17
Slurp ESRI AMD Build Files
echo "slurping esri modules"
cat $HARFILE | grep 'js/esri.*js' | awk '{print $2}' | perl -pe 's/",?//g' > "$BASEDIR/profiles/esriUrls.txt"
wget -xi "$BASEDIR/profiles/esriUrls.txt"
rsync -avh "serverapi.arcgisonline.com/jsapi/arcgis/3.5amd/js/esri" "src/"
rm -rf "serverapi.arcgisonline.com"
echo "processing esri modules"
cd "$SRCDIR/esri"
FILES=$(find .)
for f in $FILES
@stdavis
stdavis / gist:5699115
Last active December 18, 2015 00:49
AMD Formatting
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'dijit/_WidgetsInTemplateMixin',
'dojo/text!app/templates/Popup.html',
'dojo/_base/lang'
],
@stdavis
stdavis / gist:5714913
Created June 5, 2013 15:45
Last data update for SQL db table
SELECT last_user_update, *
FROM sys.dm_db_index_usage_stats
WHERE OBJECT_ID=OBJECT_ID('ROADS')