This commit is contained in:
NN Solex 2023-04-30 14:08:32 +03:00
parent ca8e39e641
commit 3b75097fed
45 changed files with 3567 additions and 0 deletions

View 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)