Nominatim

This example shows the usage of the REST API of Nominatim. The API keys are imported from a separate file. You have to rename the file “keys.zml.default” to “keys.zml” and change the API key. Get your API key from https://developer.mapquest.com/plan_purchase/free/business_edition/business_edition_free

%import keys
%import components
%inherit base

@db:
  host: 'open.mapquestapi.com'

#places: @db/nominatim/v1/search?format=json&q=Cologne&key={appkey}

*content:
  %for p in places:
    p: {p.display_name}

The rendered result showing the nominatim results for the term ‘Cologne’:

<!DOCTYPE html>
<html>
  <head>
    <title>zml</title>
  </head>
  <body>
      <p>Köln, Regierungsbezirk Köln, Nordrhein-Westfalen, 50667-51149, Deutschland</p>
  <p>Köln, Regierungsbezirk Köln, Nordrhein-Westfalen, Deutschland</p>
  <p>Cologne, BS, LOM, Italia</p>
  <p>Cologne, BS, LOM, Italia</p>
  <p>Cologne, Auch, Gers, Midi-Pyrénées, France métropolitaine, 32430, France</p>
  <p>La Cologne, Tincourt-Boucly, Péronne, Somme, Picardie, France métropolitaine, 80240, France</p>
  <p>La Cologne, Doingt, Péronne, Somme, Picardie, France métropolitaine, 80200, France</p>
  <p>La Cologne, Péronne, Somme, Picardie, France métropolitaine, France</p>
  <p>La Cologne, Cartigny, Péronne, Somme, Picardie, France métropolitaine, 80200, France</p>
  <p>La Cologne, Péronne, Somme, Picardie, France métropolitaine, France</p>
  </body>
</html>