Skip to content

Instantly share code, notes, and snippets.

View odoe's full-sized avatar
👽
It's full of stars

Rene Rubalcava odoe

👽
It's full of stars
View GitHub Profile
@odoe
odoe / cbtrain.js
Created September 20, 2011 22:43
Callback train
var districtHandler = function(result) {
if (query_manhole && query_manhole.length > 4) {
var srv = new ServiceHandler();
srv.handleResponse(result, distGrid, function() {
proxy.sigmaDJOForManhole( query_manhole, new Async( function(distResult) {
if ( distResult.length > 0 ) {
var value = distGrid.store.fetch( { query: {DJO: distResult},
onComplete: function(items, r) {
var index = distGrid.getItemIndex(items[0]);
distGrid.selection.setSelected(index, true);
@odoe
odoe / shimexample.js
Created October 20, 2011 15:30
JavaScript shim for Node.js EventEmitter
var EXTENSION = require(__dirname + '/build/default/extension.node').EXTENSION;
var events = require('events');
inherits(EXTENSION, events.EventEmitter);
exports.EXTENSION = EXTENSION;
function inherits(target, source) {
for (var k in source.prototype) {
target.prototype[k] = source.prototype[k];
}
@odoe
odoe / esritogeo.js
Created November 23, 2011 16:58
Convert ESRI-JSON to GeoJSON
var stripJSON = function(str) {
return str.replace(/\\n/g, "\\n")
.replace(/\\t/g, "\\t");
};
var jsonToObject = function(stringIn) {
var data;
try {
data = JSON.parse(stripJSON(stringIn));
console.log("json converted to object");
@odoe
odoe / deed.html
Created March 1, 2012 22:37
Simple example using underscore.js for ArcGIS JS API InfoWindow Templates
<table>
<tr>
<td>Grant Deed</td>
<td>${Grant Deed Number}</td>
</tr>
<tr>
<td>Grant Deed</td>
<td>${Grant Deed Number 2}</td>
</tr>
<tr>
@odoe
odoe / esrileaf.html
Created April 19, 2012 21:08
Demo of Backbone.js using ESRI REST in Leaflet
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta content='text/html, charset=UTF-8' http-equiv='Content-Type' />
<meta content='IE=7,IE=8,IE=9' http-equiv='X-UA-Compatible' />
<meta content='initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport' />
<style type="text/css">
@import url("http://code.leafletjs.com/leaflet-0.3.1/leaflet.css");
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
@odoe
odoe / create_sde_connection.py
Created April 26, 2012 20:07
Arcpy script to add data to mxd and publish to ArcGIS server without ArcMap
'''
Created on Feb 24, 2011
The purpose of this script is to create the SDE connection file needed to connect to your SDE
@author: rrubalcava
'''
import os, arcpy
class CreateSDEConnection:
@odoe
odoe / app.build.js
Created July 12, 2012 15:46
Build file to optimize ArcGIS JavaScript 3.0 apps using r.js (Require.js optimizer)
/**
* This is the build file I have started using
* to build my ArcGIS JS API 3.0 apps, which are
* based on Dojo 1.7. I used a similar build file
* when I was using Require.js, so it wasn't much different.
*
* I tried using the Dojo Build Tools, but it just seemed
* way too bloated to download the Dojo SDK, sort my files,
* blah blah blah. With r.js I can use Node NPM to
* npm install requirejs and just use the following command
@odoe
odoe / geotofeature.py
Created September 10, 2012 21:13
ArcPy script to Convert GeoJSON to Feature Classes
# This is a script that I use to convert geojson to
# features in a file gdb
# Step 1. Use the REST page of an ArcGIS Map Service to
# get the esri json results of the data you want.
# Step 2. I used my EsriJSON to GeoJSON app to convert
# the results to geojson. http://esritogeo.herokuapp.com/
# Step 3. In ArcMap, use the python window to create a
# python dictionary of your geojson.
# Step4. Use the following script to convert that geojson
# into featureclasses and then merge them.
@odoe
odoe / EventedMap.js
Created September 17, 2012 22:05
Evented based esri.Map
// Because I was bored and wanted to use the foo.on() method with my map
define(['dojo/_base/declare', 'dojo/Evented'], function(declare, Evented) {
var EventedMap = declare([Evented, esri.Map], {
constructor: function() {
var _this = this;
dojo.connect(this, "onClick", function(event) {
return _this.emit("click", event);
});
dojo.connect(this, "onDblClick", function(event) {
@odoe
odoe / BasemapGalleryMenuWidget.coffee
Created October 1, 2012 20:38
Dojo 1.7 Dijit for use with the ArcGIS JavaScript API
###
# This is a simple, basic BasemapGallery menu dijit for use with the
# ArcGIS JavaScript API.
# This will create a menu dijit of checkbox items that correspond
# to basemaps in the BasemapGallery dijit.
# Since there is not RadioMenuItem, this dijit will make sure only
# the selected basemap in the menu is checked.
# For reference, see http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/basemapgallery.htm
###
define [