This file contains 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
def georef(self, localities): | |
for loc in localities: | |
loc.feature_geocodes = {} | |
for feature in loc.parts['features']: | |
logging.info('Geocoding feature "%s"' % feature) | |
key = 'geocode-%s' % feature | |
geocode = Cache.get(key) | |
if not geocode: | |
geocode = self.geocoder.geocode(feature) | |
Cache.put(key, geocode) |
This file contains 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
occurrenceid,genus,year,country | |
1,bufo,1988,china | |
2,salmo,1900,united states | |
3,tuco,1985,argentina | |
4,vultur,2010,chile | |
5,atrox,1985,mexico |
This file contains 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
# This section provides information about the source, such as name and contact | |
# information. | |
# | |
Source: | |
name: IUCN | |
email: [email protected] | |
# This section provides information about all collections provided by the | |
# source. | |
# |
This file contains 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
{ | |
"bio19":{ | |
"maxval":5162, | |
"name":"Precipitation of Coldest Quarter", | |
"minval":0, | |
"created":"2006-01-04", | |
"srs":"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", | |
"version":"1.4", | |
"database":"WorldClim", | |
"key":"bio19", |
This file contains 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
4386-4956,'{"_id": "4386-4956", "b": [["-124.6731519", "48.7"], ["-124.6605375", "48.6916667"]], "t": "11", "v": {"b16": "1084"}}' | |
4371-4956,'{"_id": "4371-4956", "b": [["-124.8623682", "48.7"], ["-124.8497538", "48.6916667"]], "t": "11", "v": {"b16": "1092"}}' | |
4374-4956,'{"_id": "4374-4956", "b": [["-124.8245249", "48.7"], ["-124.8119105", "48.6916667"]], "t": "11", "v": {"b16": "1078"}}' | |
4377-4956,'{"_id": "4377-4956", "b": [["-124.7866817", "48.7"], ["-124.7740672", "48.6916667"]], "t": "11", "v": {"b16": "1034"}}' | |
4383-4956,'{"_id": "4383-4956", "b": [["-124.7109951", "48.7"], ["-124.6983807", "48.6916667"]], "t": "11", "v": {"b16": "1079"}}' | |
4375-4956,'{"_id": "4375-4956", "b": [["-124.8119105", "48.7"], ["-124.7992961", "48.6916667"]], "t": "11", "v": {"b16": "1034"}}' | |
4369-4956,'{"_id": "4369-4956", "b": [["-124.887597", "48.7"], ["-124.8749826", "48.6916667"]], "t": "11", "v": {"b16": "1088"}}' | |
4388-4956,'{"_id": "4388-4956", "b": [["-124.647923", "48.7"], ["-124.6353086", "48.6916667"]], "t": "11", " |
This file contains 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
cells = {} | |
dr = csv.DictReader(open(csvfile, 'r')) | |
for row in dr: | |
cellkey = row.get('CellKey') | |
if not cells.has_key(cellkey): | |
cells[cellkey] = { | |
'_id': cellkey, | |
't': options.key, # tile number | |
'b': getboundingbox(cellkey, cells_per_degree), # boundingbox | |
'v': {} # dictionary of variables (tmean1,...tmin1,...tmax1,...alt,...prec1,...bio1,...) |
This file contains 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
newcells = dict((k, simplejson.dumps(v)) for k,v in cells.iteritems()) | |
dict: { | |
'4371-4956': '{"_id": "4371-4956", "b": [["-124.8623682", "48.7"], ["-124.8497538", "48.6916667"]], "t": "11", "v": {"b16": "1092"}}', | |
'4374-4956': '{"_id": "4374-4956", "b": [["-124.8245249", "48.7"], ["-124.8119105", "48.6916667"]], "t": "11", "v": {"b16": "1078"}}' | |
} |
This file contains 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
def __eq__(self, other): | |
if not isinstance(other, BoundingBox): | |
return NotImplemented | |
if self.nw != other.nw: | |
return NotImplemented | |
if self.se != other.se: | |
return NotImplemented | |
return True |
This file contains 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
WC_ALIAS = dict( | |
tmean1='m1', | |
tmean2='m2', | |
tmean3='m3', | |
tmean4='m4', | |
tmean5='m5', | |
tmean6='m6', | |
tmean7='m7', | |
tmean8='m8', | |
tmean9='m9', |
This file contains 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
SELECT | |
i_feature_footprint.feature_id, geom_y, geom_x, radius, displayname, | |
i_scheme_term.term, g_collection.name, g_collection.mapaccuracyinmeters, | |
g_collection.coordprecision | |
FROM | |
i_feature_footprint, | |
g_feature, | |
g_feature_displayname, | |
i_scheme_term, | |
i_classification, |