init
This commit is contained in:
parent
ca8e39e641
commit
3b75097fed
45 changed files with 3567 additions and 0 deletions
12
web/plugins/geohash/geohash.py
Normal file
12
web/plugins/geohash/geohash.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from pelican import signals
|
||||
import geohash_tools as gh
|
||||
|
||||
def generate_geohash(generator):
|
||||
for article in generator.articles:
|
||||
if "location" in article.metadata:
|
||||
lat, lon = [float(i) for i in article.metadata['location'].replace(' ', '').split(',')]
|
||||
article.metadata['latlon'] = article.metadata['location'].replace(' ', '')
|
||||
article.metadata['geohash'] = gh.encode(lat, lon, 11)
|
||||
|
||||
def register():
|
||||
signals.article_generator_finalized.connect(generate_geohash)
|
||||
Loading…
Add table
Add a link
Reference in a new issue