[OSM-dev] nominatim-like wildcard search
Hi! I'm trying to build a autocompletion name lookup for a HTML5-based cycle map. Is there any API where you can make wildcard nominatim-style lookups? For exempel Bre* would return Bremen, Brenner etc. I will limit my queries by bbox, but other sorting and limiting, like sorting by distance to a given point, or place category, would be useful. I have my own database, so I'm fine with installing my own instance of the API if server load would be too high otherwise. Just prefer not re-inventing the wheel if it's already there (not much found by google). Probably somewhat like http://oegeo.wordpress.com/2010/11/08/a-better-search-field-for-openstreetmap/ Seem to be suggested in http://wiki.openstreetmap.org/wiki/Nominatim/Version2 but I see no indication of that being implemented ... best regards Per Eric -- ^): Per Eric Rosén http://rosnix.net/~per/ / pero9...@student.uu.se · p...@rosnix.net · 0709-461000 GPG 7A7A BD68 ADC0 01E1 F560 79FD 33D1 1EC3 1EBB 7311___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] nominatim-like wildcard search
For exempel Bre* would return Bremen, Brenner etc. I will limit my queries by bbox, You can use Overpass API: E.g. http://overpass-api.de/api/interpreter?data=(rel[name~^Bre](50.6,7.0,50.8,7.3);way[name~^Bre](50.6,7.0,50.8,7.3);node[name~^Bre](50.6,7.0,50.8,7.3););out; gives all elements that have a name tag starting with Bre. The result is not sorted, but this should be no problem on the client side, given that these queries don't produce too much data. The bounding box order is (south,west,north,east). The term ^Bre is the regular expression matching all strings beginning with Bre. Of course, you can also search without a bounding box, but in that case you should give further restrictions: http://overpass-api.de/api/interpreter?data=(rel[name~^Bre][place=city];way[name~^Bre][place=city];node[name~^Bre][place=city];);out; If you are interested, feel free to ask for more details. Cheers, Roland ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] nominatim-like wildcard search
Hi Per, this topic seems to come up frequently lately and I'm actually glad you asked before going off implementing something. So forgive me if I jump in with a more general remark on the topic. On Wed, Aug 29, 2012 at 12:26:02PM +0200, Per Eric Rosén wrote: I'm trying to build a autocompletion name lookup for a HTML5-based cycle map. Is there any API where you can make wildcard nominatim-style lookups? For exempel Bre* would return Bremen, Brenner etc. I will limit my queries by bbox, but other sorting and limiting, like sorting by distance to a given point, or place category, would be useful. Probably somewhat like http://oegeo.wordpress.com/2010/11/08/a-better-search-field-for-openstreetmap/ Seem to be suggested in http://wiki.openstreetmap.org/wiki/Nominatim/Version2 but I see no indication of that being implemented ... This is not yet implemented in Nominatim and using the current API to implement it client-side will not work because Nominatim only returns complete matches, i.e. in your example 'Bre' will never return 'Bremen'. It will return an empty result and such empty queries are the really expensive ones that give the server a hard time. Please, people, *do not implement auto-complete on top of nominatim.osm.org*. You will just end up flooding the server with so many nonsense requests that you attract the attention of the sysadmins. You do not want that. If you run your own installation of Nominatim, you are of course welcome to do whatever you want with it. Sarah ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] nominatim-like wildcard search
Thanks. Of course there is no idea implementing it against current Nominatim, if it doesn't support partial names. Neither doing it with Overpass and client-side sorting may be the most efficient solution. Until Nominatim 2 is ready, I'll probably (this afternoon perhaps) hack together some utility that transform data from a local postgis (used for mapnik) to some more search friendly structure, and export with a simple JSON API on top of. /Per Eric -- ^): Per Eric Rosén http://rosnix.net/~per/ / p...@rosnix.net GPG 7A7A BD68 ADC0 01E1 F560 79FD 33D1 1EC3 1EBB 7311___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev