The task of finding the exact location in the city based on a photo seems difficult, but modern geolocation methods greatly simplify this process. In this article, we will consider a detailed algorithm, how it was possible to identify a specific place on the map based on the panorama of one of the safe cities of France – Dijon.
The team began solving the task only after the author pointed to a list of the ten safest cities in France. According to him, the panorama was taken in one of the following cities: Toulouse, Saint-Gaudens, Nice, Rennes, Bordeaux, Avignon, Tours, Cannes, Dijon or Reims.
The panorama shows the streetscape: a bicycle path, a house with a fence and a lamppost with a sign:
As a result, Dijon or possibly Avignon became the most likely options. The search began in Dijon.
At the same time, it was possible to establish that the first word on the blue pointer is RUE, while the black one probably says BOULEVARD (the length of the word corresponds to other designations of this type of street). After analyzing numerous indicators, some assumptions were formed (although not all of them turned out to be correct):
There are two words in the name rue.
The name rue is written in caps, so this name is a Surname, since the name in the name of the street is not written in caps. There are much fewer such streets.
The name is 13-15 characters long, including a space, because it is long enough to fill the width of the pointer, but the second word is not wrapped on a new line.
The length of the name Boulevard is also 13-15 for the same reason.
All these assumptions were tested using Overpass. The search for intersections of boulevards and streets was carried out, taking into account the length of the names and the number of words. Special attention was paid to boulevards with names longer than 12 characters.
area [ name = Dijon ] [ admin_level = 8 ] ->. a ; way [ highway ] [ name ~ "^boulevard .{12,}$" , i ] ( area . a ) ->. ways ; foreach . ways ->. this_way { rel ( bw.this_way ) - > . this_rel ; node ( w.this_way ) - > . this_way_nodes ; way [ highway ] [ name ~ "^rue \\S+ \\S+$" , i ] ( bn . this_way_nodes ) ->. linked_ways ; ( way.linked_ways ; - ( way ( r.this_rel ) ; way.this_way ; ) ; ) ->. linked_ways_only ; node ( w . linked_ways_only ) ->. linked_ways_only_nodes ; node . linked_ways_only_nodes . this_way_nodes ; out ; }
A script was created that allowed mass download of OSM points using OPQL queries, obtaining panoramas with satellite images.
With enough persistence, a point could be found even on this query, but the number of points was large and a thorough examination of each was impossible.
Various methods and combinations were used to determine what else besides the word “rue” could be on this index, but these attempts were unsuccessful.
After viewing a lot of panoramas, finally convinced that it was Dijon, it was decided to dump the street lists through the Overpass, using regular expressions, and expand the search area to the boundaries of the entire municipality. Request:
[ out : csv ( name , :: id ) ] ; area [ name = Dijon ] [ admin_level = 7 ] ->. a ; way [ name ~ "^rue \\S{5,7} \\S{6,8}$" , i ] ( area . a ) ; out geom ;
As a result, a list of streets was downloaded, which turned out to be 294. After sifting through the names of the “First Name Surname” format, there were few options left:
Rue Colonel Ballet Rue Colonel Driant Rue Colonel Marcaire Rue Colonel Picard Rue Colonel Quantin Rue Colonel Redoutey Rue Devant L'église Rue Docteur Calmette Rue Docteur Chauveau Rue Docteur Durande Rue Docteur Lavalle Rue Docteur Maillard Rue Docteur Parizot Rue Docteur Quignard Rue Docteur Renardet Rue Docteur Tarnier Rue General Bouchu Rue General Cambel Rue Général Giraud Rue Général Joubert Rue Longe L'église Rue Maison Blanche Rue Minot Museux Rue Neuve Bergère Rue Neuve Dauphine
After checking these streets, no results were received. It was decided to carefully analyze the photo once again.
After a little walk in Dijon, we meet the same one:
Created a request to get a list of boulevards to be able to check them manually.
[ out : csv ( name , :: id ) ] ; area [ name = Dijon ] [ admin_level = 7 ] ->. a ; way [ name ~ "^boulevard" , i ] ( area . a ) ; out geom ;
We get as many as 82 boulevards in the municipality of Dijon:
Boulevard Albert Einstein Boulevard Alexandre 1er de Yougoslavie Boulevard Bernard Palissy Boulevard Carnot Boulevard Chanoine Kir Boulevard Charles de Gaulle Boulevard Docteur Jean Veillet Boulevard Docteur Petitjean Boulevard Edmé Nicolas Machureau Boulevard Eiffel Boulevard Eugène Fyot Boulevard Eugène Spuller Boulevard François Pompon Boulevard Gabriel Boulevard Gaston Bachelard Boulevard Georges Clemenceau Boulevard Henri Bazin Boulevard Henri Camp Boulevard Jean Jaurès Boulevard Jean Moulin Boulevard Jeanne d'Arc Boulevard John Fitzgerald Kennedy Boulevard John Kennedy Boulevard Maillard Boulevard Mansart Boulevard Marmont Boulevard Maréchal Gallieni Boulevard Maréchal Joffre Boulevard Maréchal Juin Boulevard Maréchal Leclerc Boulevard Maréchal de Lattre de Tassigny Boulevard Montaigne Boulevard Olivier de Serres Boulevard Pascal Boulevard Pasteur Boulevard Paul Doumer Boulevard Rembrandt Boulevard Robert Schuman Boulevard Sévigné Boulevard Thiers Boulevard Trimolet Boulevard Voltaire Boulevard Winston Churchill Boulevard de Beauregard Boulevard de Bellevue Boulevard de Brosses Boulevard de Champagne Boulevard de Chicago Boulevard de Chèvre Morte Boulevard de Strasbourg Boulevard de Sévigné Boulevard de Troyes Boulevard de Verdun Boulevard de l'Europe Boulevard de l'Ouest Boulevard de l'Université Boulevard de la Croix Saint-Martin Boulevard de la Défense Boulevard de la Fontaine des Suisses Boulevard de la Marne Boulevard de la Motte Boulevard de la Trémouille Boulevard des Aiguillottes Boulevard des Allobroges Boulevard des Bourroches Boulevard des Clomiers Boulevard des Diables Bleus Boulevard des Gorgets Boulevard des Herbues Boulevard des Hortensias Boulevard des Industries Boulevard des Martyrs de la Résistance Boulevard des Peyvets Boulevard des Valendons Boulevard du 1er RAD Boulevard du Castel Boulevard du Champ aux Métiers Boulevard du Colonel Charles Flamand Boulevard du Grand Marché Boulevard du Maréchal Leclerc Boulevard du Maréchal de Lattre de Tassigny Boulevard Édouard Branly
Finally, an example of an optimal OPQL query for this task that could be constructed based on the above assumptions, discarding the false ones, is provided. This query returns only five points, all of which are located on the desired boulevard.
area [ name = Dijon ] [ admin_level = 8 ] ->. dijon ; way [ highway ] [ name ~ "^boulevard .{13,}" , i ] ( area . dijon ) ->. bouls ; ( way . bouls [ "cycleway:both" = lane ] ; way . bouls [ cycleway = lane ] ; ) ->. cycles ; foreach . cycles - > this_way { rel . ( bn . this_way_nodes ) ->. linked_ways ; ( way.linked_ways ; - ( way ( r.this_rel ) ; way.this_way ; ) ; ) ->. linked_ways_only ; node ( w . linked_ways_only ) ->. linked_ways_only_nodes ; node . linked_ways_only_nodes . this_way_nodes ; out ;
As a result, a detailed analysis of the details of the panorama, such as bike paths, terracotta roofs, color indicators and the specifics of the placement of lamps, allowed to find the exact place in the French city of Dijon. With the help of OSM and OPQL tools, a number of queries were compiled, which significantly reduced the list of potential locations, and the improvement of the query made it possible to quickly obtain the necessary coordinates.
This process highlights how careful attention to detail and the use of modern mapping tools can help achieve accurate results in even the most complex geolocation tasks.