# Overpass

# Déployer instance OverPass API avec Docker

Ce compose permet de déployer une instance locale de l’API Overpass, utilisée pour interroger les données d’OpenStreetMap. Cette configuration est optimisée pour un usage sur les données de la France, à partir d’un extrait officiel.

Elle repose sur l’image Docker `wiktorn/overpass-api` : [https://github.com/wiktorn/Overpass-API](https://github.com/wiktorn/Overpass-API)

```yaml
services:
  overpass:
    image: wiktorn/overpass-api
    container_name: overpass_france
    restart: unless-stopped
    environment:
      OVERPASS_MODE: init
      OVERPASS_META: yes
      OVERPASS_PLANET_URL: https://download.openstreetmap.fr/extracts/europe/france-latest.osm.pbf
      OVERPASS_PLANET_PREPROCESS: 'mv /db/planet.osm.bz2 /db/planet.osm.pbf && osmium cat -o /db/planet.osm.bz2 /db/planet.osm.pbf && rm /db/planet.osm.pbf'
      OVERPASS_COMPRESSION: lz4
      OVERPASS_DIFF_URL: https://download.openstreetmap.fr/replication/europe/france/minute
      OVERPASS_MAX_TIMEOUT: "1000"
      OVERPASS_UPDATE_SLEEP: "900"
      OVERPASS_FASTCGI_PROCESSES: "3"
      OVERPASS_RATE_LIMIT: "10"
      OVERPASS_SPACE: "12884901888"  # 12 Go laissés à Overpass (sur 15)
    volumes:
      - ./overpass_data:/db
    stdin_open: true
    tty: true
    deploy:
      resources:
        limits:
          cpus: "6" # Limiter 6 CPU
          memory: 15g # Limiter 15 Go de RAM
    ports:
      - 8080:80

```

# Requêtes #completetescommerces

## Extraction des commerces sans horaires à par ville

<div class="qMYqUG_convSearchResultHighlightRoot" id="bkmrk-cette-requ%C3%AAte-overpa"><div><div class="relative w-full overflow-visible"><section class="text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&:has([data-writing-block])>*]:pointer-events-auto R6Vx5W_threadScrollVars scroll-mb-[calc(var(--scroll-root-safe-area-inset-bottom,0px)+var(--thread-response-height))] scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]" dir="auto">Cette requête Overpass permet d’extraire, un ensemble de commerces, services, établissements et activités (restaurants, magasins, bureaux, artisans, hébergements, etc.) tout en filtrant ceux qui possèdent déjà la clé `opening_hours`. Elle repose sur plusieurs catégories OSM (amenity, shop, office, craft, tourism) afin de couvrir un large spectre de points d’intérêt, puis ne conserve que les objets nommés et potentiellement ouverts au public. L’objectif est d’identifier les lieux dont les horaires d’ouverture ne sont pas renseignés dans OpenStreetMap, afin d’améliorer la complétude et la qualité des données.

</section><div class="contents">  
</div></div></div></div>```json
[out:json][timeout:60];

area["name"="<NOM DE LA VILLE>"]->.ville;

(
  nw["amenity"]
    ["amenity"~"restaurant|fast_food|cafe|fuel|pharmacy|bank|bar|hospital|post_office|clinic|pub|car_wash|ice_cream|driving_school|cinema|car_rental|nightclub|bureau_de_change|studio|internet_cafe|money_transfer|casino|vehicle_inspection|frozen_food|boat_rental|coworking_space|workshop|personal_service|dancing_school|training|ski_school|ski_rental|dive_centre|driver_training|nursing_home|funeral_hall|doctors|dentist|theatre|kindergarten|language_school|stripclub|veterinary"]
    ["amenity"!~"public_bookcase|public_building"]
    ["name"]
    ["name:signed"!~"no"]
    ["noname"!~"yes"]
    [!"opening_hours"]
    (area.ville);

  nw["shop"]
    ["shop"~"convenience|supermarket|clothes|hairdresser|car_repair|bakery|beauty|car|hardware|mobile_phone|butcher|furniture|car_parts|alcohol|florist|scooter|variety_store|electronics|shoes|optician|jewelry|mall|gift|doityourself|greengrocer|books|bicycle|chemist|department_store|laundry|travel_agency|stationery|pet|sports|confectionery|tyres|cosmetics|computer|tailor|tobacco|storage_rental|dry_cleaning|trade|copyshop|motorcycle|funeral_directors|beverages|newsagent|garden_centre|massage|pastry|interior_decoration|general|deli|toys|houseware|wine|seafood|pawnbroker|tattoo|paint|wholesale|photo|second_hand|bed|kitchen|outdoor|fabric|antiques|coffee|gas|e-cigarette|perfumery|craft|hearing_aids|money_lender|appliance|electrical|tea|motorcycle_repair|boutique|baby_goods|bag|musical_instrument|dairy|pet_grooming|music|carpet|rental|fashion_accessories|cheese|cannabis|chocolate|medical_supply|leather|sewing|locksmith|games|video_games|hifi|window_blind|caravan|tool_hire|household_linen|bathroom_furnishing|shoe_repair|watches|nutrition_supplements|fishing|frame|grocery|boat|repair|gold_buyer|lighting|pottery|security|groundskeeping|herbalist|curtain|health_food|flooring|printer_ink|camera|candles|printing|garden_furniture|food|yes"]
    ["shop"!~"kiosk|vacant"]
    ["name"]
    ["name:signed"!~"no"]
    ["noname"!~"yes"]
    [!"opening_hours"]
    (area.ville);

  nw["office"]
    ["office"~"company|estate_agent|insurance|telecommunication|it|accountant|employment_agency|tax_advisor|financial|advertising_agency|logistics|newspaper|financial_advisor|consulting|travel_agent|coworking|moving_company|lawyer|architect|construction_company|developer|credit_broker|graphic_design|construction|property_management|cleaning|notary"]
    ["name"]
    ["name:signed"!~"no"]
    ["noname"!~"yes"]
    [!"opening_hours"]
    (area.ville);

  nw["craft"]
    ["craft"~"carpenter|winery|metal_construction|electronics_repair|photographer|electrician|brewery|hvac|plumber|tailor|shoemaker|sawmill|caterer|window_construction|gardener|dressmaker|confectionery|stonemason|glaziery|painter|roofer|builder|key_cutter|upholsterer|cleaning|pottery|distillery|jeweller|handicraft|joiner|agricultural_engines|tiler|insulation|clockmaker|sculptor|printer|cabinet_maker"]
    ["name"]
    ["name:signed"!~"no"]
    ["noname"!~"yes"]
    [!"opening_hours"]
    (area.ville);

  nw["tourism"]
    ["tourism"~"hotel|hostel|guest_house|motel"]
    ["name"]
    ["name:signed"!~"no"]
    ["noname"!~"yes"]
    [!"opening_hours"]
    (area.ville);
);

out body;
>;
out skel qt;
```

<div class="qMYqUG_convSearchResultHighlightRoot" id="bkmrk-sans-site-web"><div><div class="relative w-full overflow-visible"><div class="contents">Sans site web</div><div class="contents"></div></div><div class="contents"></div></div></div>```json
[out:json][timeout:60];

// Zone
area["name"="<NOM DE LA VILLE>"]->.searchArea;

// Nœuds + ways + relations utiles
(
  // POI principaux
  nwr["amenity"~"restaurant|fast_food|cafe|bar|pub|nightclub|cinema|hospital|clinic|doctors|dentist|pharmacy|bank|post_office|fuel|car_wash|car_rental|driving_school"]
    ["website"!~"."]
    (area.searchArea);

  // Shops
  nwr["shop"~"supermarket|bakery|butcher|hairdresser|car_repair|electronics|bicycle|clothes|convenience|butcher|pharmacy"]
    ["website"!~"."]
    (area.searchArea);

  // Offices
  nwr["office"~"it|insurance|estate_agent|lawyer|accountant|consulting|coworking|travel_agent"]
    ["website"!~"."]
    (area.searchArea);

  // Crafts
  nwr["craft"~"electrician|plumber|carpenter|builder|roofer|painter"]
    ["website"!~"."]
    (area.searchArea);

  // Tourism
  nwr["tourism"~"hotel|hostel|guest_house|motel"]
    ["website"!~"."]
    (area.searchArea);
);

// Sortie
out body;
>;
out skel qt;
```