Skip to content

Instantly share code, notes, and snippets.

Andrew W. Hill andrewxhill

Block or report user

Report or block andrewxhill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andrewxhill
andrewxhill / MOLTaxonomyModel.py
Created Nov 19, 2010
First implementation of a taxonomy model for the Map of Life project
View MOLTaxonomyModel.py
class Species(db.Model):
authority = db.TextProperty()
classification = db.TextProperty()
names = db.TextProperty()
class SpeciesIndex(db.Model):
names = db.StringListProperty()
authorityName = db.StringProperty()
kingdom = db.StringProperty()
phylum = db.StringProperty()
@andrewxhill
andrewxhill / gist:863036
Created Mar 9, 2011
localhost quick work
View gist:863036
#line 271
#comment out,
"""make sure that the keyname exists in MOL"""
"""
q = Species.get_by_key_name(species_key_name)
if not q:
self.error(404)
return
"""
#line 278, 279 swap which line is commented out
View gist:890806
renderMarkers: function(w,h,error){
var cnvs = $("<canvas width="+w+" height="+h+">");
var ctx = cnvs[0].getContext("2d");
ctx.drawImage(this.pmBackground, 0, 0, w, h);
if (this.type){
ctx.drawImage(this.pmType, 0, 0, w, h);
}
if (error){
View gist:890902
mol.ui.Map.MarkerCanvas = mol.ui.Element.extend(
{
init: function() {
this._width = 120;
this._height = 120;
this._super('<canvas width='+this._width+' height='+this._height+'>');
this.setStyleName('mol-MarkerCanvas');
this._ctx = null;
this._canvasSupport = false;
View gist:894879
/* Set up RightControl defaults */
#mol-Map-RightControl { margin-right: 5px; width: 290px; }
#mol-Map-RightControl .TOP { position: relative; float: left; width: 100%; height: auto; margin-bottom: 5px; }
#mol-Map-RightControl .MIDDLE { position: relative; float: left; width: 100%; height: auto; margin-bottom: 5px; }
#mol-Map-RightControl .BOTTOM { position: relative; float: left; width: 100%; height: auto; margin-bottom: 5px; }
/* Set up CenterControl defaults */
#mol-Map-CenterTopControl { margin-right: 5px; width: 290px; }
#mol-Map-CenterTopControl .TOP { position: relative; float: left; width: 100%; height: auto; margin-bottom: 5px; }
#mol-Map-CenterTopControl .MIDDLE { position: relative; float: left; width: 100%; height: auto; margin-bottom: 5px; }
View gist:896930
result = {
SearchTerm: 'Puma',
SourceTypes : {
GBIFPoints : {
id: 1,
layers: [123,
0323,
434,
533,],
},
View gist:908456
var mol = MOL(function(mol) {
bus = new mol.events.Bus();
api = new mol.ajax.Api(bus);
var config = {bus: bus, api: api, logging:true};
var app = new mol.app.Instance(config);
app.run();
return this;
});
View gist:935482
# ------------------------------------------------------------------------------
# TaxonomyService
class TaxonomyProvider(object):
def __init__(self):
pass
def _key(self, k):
raise NotImplementedError()
View gist:954147
class EcoregionLayerIndex(db.Model): #parent = an EcoregionSet
terms = db.CategoryProperty()
class EcoregionLayer(db.Model):
name = db.StringProperty()
id = db.StringProperty()
ecoCodes = db.ListProperty(db.Key)
class MOLLayers(db.Model):
layer = db.Key()
View gist:954622
class OccurrenceSetIndex(db.Model): #parent = OccurrenceSet see below
terms = db.ListProperty() #string values to search for sets
class OccurrenceSet(db.Model): #key_name = wwf/puma_concolor or something
name = db.StringProperty() #this could be non-unique, Puma concolor is fine
source = db.StringProperty() #wwf
info = db.BlobProperty() #some meta standard for sets of occ polygons
class OccurrenceIndex(db.Model): #parent = OccurrencePolygon see below
introduced = db.BooleanProperty()
You can’t perform that action at this time.