This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
openstates_t = 'http://openstates.org/api/v1/legislators/geo/?lat={lat}&long={long}' | |
sunlight_t = 'https://congress.api.sunlightfoundation.com/legislators/locate?latitude={lat}&longitude={long}' | |
geocoding_t = 'https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address={address}&benchmark=9&format=json' | |
def get_coordinates(address): | |
url = geocoding_t.format(address=address) | |
x, y = requests.get(url).json().get('result').get('addressMatches')[0].get('coordinates').values() | |
return x, y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:+ {:app {} | |
:editor {"alt-w" [:editor.watch.watch-selection] | |
"alt-shift-w" [:editor.watch.unwatch] | |
"pmeta-/" [:toggle-comment-selection] | |
"pmeta-d" [:editor.sublime.selectNextOccurrence] | |
"pmeta-ctrl-up" [:editor.sublime.swapLineUp] | |
"pmeta-ctrl-down" [:editor.sublime.swapLineDown] | |
"ctrl-shift-up" [:editor.sublime.selectLinesUpward] | |
"ctrl-shift-down" [:editor.sublime.selectLinesDownward]}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_INDEX = { | |
'default': { | |
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', | |
'URL': 'http://127.0.0.1:9200/', | |
'TIMEOUT': 60 * 10, | |
'INDEX_NAME': 'test_index', | |
}, | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Layer = Backbone.Model.extend(); | |
Layer.prototype.initialize = function() { | |
var lyr = new olCls(this.get('name'), this.get('url'), opts); | |
this.set({ olLayer: lyr }); | |
}; | |
LayerView.prototype.render = function() { | |
var view = this; | |
var trucks = new Layer({name: 'Vehicles'); | |
view.map.addLayer(trucks); | |
// refresh the vehicles and turn them into markers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgisscripting as arc | |
import nx_spatial as ns | |
# add the fcs to networkx network | |
G = ns.read_fc(workingdir, gp) | |
tx = ns.attr_find(G, FcName="Transformer") | |
#break up net into connected components | |
components = nx.connected_components(G.to_undirected()) | |
for c in components: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcgisscripting as arc | |
import csv | |
import networkx as nx | |
import nx_spatial as ns | |
gp = arc.create(9.3) | |
features = [ | |
"ServicePoint", | |
"Transformer", | |
"SecUGElectricLineSegment", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable Features(IFeatureCursor featureEnum) | |
{ | |
IFeature f = featureEnum.NextFeature(); | |
while (f != null) | |
{ | |
yield return f; | |
f = featureEnum.NextFeature(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ArcInfoWorkspaceFactoryClass(); | |
ESRI.ArcGIS.Geodatabase.IWorkspace workspace = workspaceFactory.OpenFromFile(databaseOrDirectory, 0); | |
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)workspace; | |
ESRI.ArcGIS.Geodatabase.IFeatureDataset featureDataset = featureWorkspace.OpenFeatureDataset(featureClassName); | |
ESRI.ArcGIS.Geodatabase.IFeatureClass fc = (IFeatureClass)featureDataset; |