Update instagram-locations.py

In my opinion, this code is a little bit more clear.
This commit is contained in:
Pimverleg
2021-11-08 14:20:40 +01:00
committed by GitHub
parent 7d718112b6
commit fd8882d1a8

View File

@@ -41,17 +41,17 @@ def get_fuzzy_locations(lat, lng, cookie, sigma=2):
return locs
# converts list of instagram locations into valid geojson
def make_geojson(locs):
def make_geojson(locations):
features = []
for l in [l for l in locs if 'lng' in l]:
for location in [location for location in locations if 'lng' in location]:
feature = {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [l["lng"], l["lat"]]
"coordinates": [location["lng"], location["lat"]]
},
"properties": l}
"properties": location}
features.append(feature)
return {"type": "FeatureCollection", "features": features}