ColdSteelShoot Investigation
The primary clue in my investigation is the fact that two bakeries, located within 3km of each other, bear the same name. I'm also considering the regional slang "chocolatine" and assuming that this person lives in Nouvelle-Aquitaine to utter such nonsense.
For my research, I rely on Overpass Turbo, which allows me to write queries and export them in JSON format.
Enumeration of Bakeries in Aquitaine
[out:json];
area["name"="Aquitaine"]->.searchArea;
(
node["shop"="bakery"](area.searchArea);
way["shop"="bakery"](area.searchArea);
relation["shop"="bakery"](area.searchArea);
);
out center;
Enumeration of Bakeries in Aquitaine Within 3km of Another Bakery
[out:json];
area["name"="Aquitaine"]->.searchArea;
(
node["shop"="bakery"](area.searchArea);
way["shop"="bakery"](area.searchArea);
relation["shop"="bakery"](area.searchArea);
);
out center;
map_to_area -> .bakery_area;
(
node["shop"="bakery"](around.bakery_area:3000);
way["shop"="bakery"](around.bakery_area:3000);
)
From there we extract a huge json file and parse it,
we only keep bakeries which are (at least) 3km close to other bakeries, sharing the same name.
import json
from geopy.distance import geodesic
import pdb
# Ouvrir le fichier JSON et charger les données
with open('chocobaker.json', 'r') as f:
data = json.load(f)
# On stocke les informations de chaque boulangerie dans une liste
bakeries = []
interest = {}
for feature in data['features']:
name = feature['properties'].get('name')
if name == "null": #NULL AVOIDANCE FOR NOW
continue
coordinates = feature['geometry']['coordinates']
bakeries.append((name, coordinates))
# Calculer la distance entre chaque paire de boulangeries avec le même nom
dict_index = 0
for i in range(len(bakeries)):
for j in range(i+1, len(bakeries)):
if bakeries[i][0] == bakeries[j][0] and bakeries[i][0]: # Si les boulangeries ont le même nom
distance = geodesic(bakeries[i][1], bakeries[j][1]).km
if distance >= 2.5 and distance <= 3: # Si les boulangeries sont à moins de 4 km l'une de l'autre (pour faire large)
interest[dict_index] = (bakeries[i], bakeries[j], distance)
dict_index += 1
# write to json file the interest content
with open('interest.json', 'w') as f:
json.dump(interest, f)
#ordering index based on distance then back to interest.json file, i will set higer distance first
sorted_interest = dict(sorted(interest.items(), key=lambda item: item[1][2], reverse=True))
with open('interest.json', 'w') as f:
json.dump(sorted_interest, f)
The json output is accessible here
We end up with 22 entries in that JSON file, my only idea for now would be too look at the comment section on google of each of theses bakeries.
Which is pretty sad...
Maybe looking at relevant stores nearby or idk... we'll see.
For now lets review bakeries ?!
ColdSteelShoot
L'indice principale sur lequel je travail est le fait que deux boulangeries à 3Km de distance l'une de l'autre porte le meme nom. Je me base aussi sur le slang "chocolatine" et assume que cette odieuse personne vie en nouvelle-acquitaine pour dire des betises pareil.
Pour faire mes recherches je m'appuie sur overpass turbo qui permet d'écrire des requetes et de les exporter au format JSON.
Enumeration des boulangeries d'Acquitaine
[out:json];
area["name"="Aquitaine"]->.searchArea;
(
node["shop"="bakery"](area.searchArea);
way["shop"="bakery"](area.searchArea);
relation["shop"="bakery"](area.searchArea);
);
out center;
Enumeration des boulangeries d'Acquitaine étant à 3km ou moins de distance d'une autre boulangerie
[out:json];
area["name"="Aquitaine"]->.searchArea;
(
node["shop"="bakery"](area.searchArea);
way["shop"="bakery"](area.searchArea);
relation["shop"="bakery"](area.searchArea);
);
out center;
map_to_area -> .bakery_area;
(
node["shop"="bakery"](around.bakery_area:3000);
way["shop"="bakery"](around.bakery_area:3000);
relation["shop"="bakery"](around.bakery_area:3000);
);
.bakery_area map_to_area -> .nearby_bakeries;
(
.bakery_area; - .nearby_bakeries;
);
out center;
Je ne sais pas s'il est possile de filtrer uniquement les boulangeries portant le meme nom sur 3km, je n'ai pas trouvé mon bonheur... J'exporte au format JSON le resultat, puis écris un petit script en Python. Le script va étudier les boulangeries une a une, et verifier si au moins une autre boulangerie est a proximité sur 3km.
je commence par checker entre [2,3] Km limite comprise if distance >= 2 and distance <= 3:
(venv) ralsei@DESKTOP-6VGJ0G9:~/Documents/reports/blog/ctf404$ cat interest.json |jq |tail -n 20
2.621192964572574
],
"32": [
[
"Boulangerie Eugénie",
[
-1.5082115,
43.4817558
]
],
[
"Boulangerie Eugénie",
[
-1.5291,
43.4945093
]
],
2.710924296975821
]
}
J'ai eu a filter sur les boulangerie qui ont un nom, pour certaines le nom n'est pas referrencé sur overpass turbo...
Si je ne trouve rien a partir d'ici, je m'occuperai separement des boulangeries "sans noms".
32 index après le parsing, assez lourd de travailler la dessus... Je ressert en esperant que le/la créateur du challenge ne soit pas un(e) sadique. if distance >= 2.8 and distance <= 3.2:
4ème couple de boulangerie sur 8, trouve enfin une occurence qui se situe dans une ville qui n'est pas Bordeaux !
ColdSteelShoot faisant refference à une "petite ville" je reste alerte.
Je vais voir les commentaires de ces deux boulangeries situées a Pau, rien d'interessant...
visiblement je ne sais pas lire...
Je suis passé prendre des chocolatines pour mes parents ce matin, je suis tombé sur une boulangerie incroyable ! Fait amusant, à moins de 3 km aux alentours une autre boulangerie porte le même nom 😂
Il va bien falloir prendre TOUT ce qui est en dessous de 3KM ce qui fait enormement de boulangerie.... je pleure à nouveau.
Cependant le post suivant laisse a penser qu'on va tout de meme bien pouvoir filtrer.
Arrivée chez mes parents, ca fait du bien de revoir sa petite ville !!
on reprends... if distance >= 2.5 and distance <= 3:
pour vérifier puis on elargit vers le bas petit a petit au besion
Enumeration des boulangeries d'Acquitaine étant à 3km ou moins de distance d'une autre boulangerie
[out:json];
area["name"="Aquitaine"]->.searchArea;
(
node["shop"="bakery"](area.searchArea);
way["shop"="bakery"](area.searchArea);
relation["shop"="bakery"](area.searchArea);
);
out center;
map_to_area -> .bakery_area;
(
node["shop"="bakery"](around.bakery_area:3000);
way["shop"="bakery"](around.bakery_area:3000);
relation["shop"="bakery"](around.bakery_area:3000);
);
.bakery_area map_to_area -> .nearby_bakeries;
(
.bakery_area; - .nearby_bakeries;
);
out center;
on va rester sur 2 min quand meme j'aimerais dormir ce mois-ci
if distance >=2 and distance <= 3:
- Qu'est ce qu'une petite ville ? en terme de population ou de surface ? il faudrait vérifier si je peux jouer sur ces parametres depuis overpass.