NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I'm trying to get WKT polygons of cities and countries from Nominatim (for example, Paris and France). I send a GET request but it returns me several results named "Paris". How may I narrow results only to the capital. Here's my request url:

http://nominatim.openstreetmap.org/search/fr/paris?format=json&polygon_geojson=1

And I get an array of 10 objects, only one is the capital,

class: "boundary", type: "administrative".

The rest are:

class: "place", type: "isolated_dwelling"
class: "place", type: "hamlet",
class: "place", type: "neighbourhood"
and so on...

How to select only the desired city and only the desired country ignoring rest of results?

asked 08 Nov '13, 16:10

green10701's gravatar image

green10701
16111
accept rate: 0%


There's probably no guaranteed way to do this but several things that can help:

  • Limit the number of results to one by adding &limit=1 (example)
  • Request only certain feature types by adding &featuretype=city (example)
  • Request only cities named "Paris" in a country named "France" by using as structured query: search?city=Paris (example)
permanent link

answered 09 Nov '13, 15:01

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

edited 09 Nov '13, 15:03

Apparently the featuretype parameter was removed https://github.com/osm-search/Nominatim/issues/1938

(16 Sep '22, 05:22) cyberixae

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×689

question asked: 08 Nov '13, 16:10

question was seen: 12,655 times

last updated: 16 Sep '22, 05:22

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum