Hi Ryan, On Tue, Mar 17, 2015 at 09:26:27PM +0000, Ryan Powell wrote: > Hi, > > I'm trying to change the reverse api to: > 1. return only the nearest road (no pois)
You can do this already with the zoom parameter. zoom=17 restricts features to road level. > 2. return the polygon points on that road That's a frequently requested feature which should not be too difficult to implement. There already is an issue https://github.com/twain47/Nominatim/issues/138 (I'll copy this explanation there as well.) Basically, both search and reverse first find the correct result (the place_id in the placex table that contains all places known to Nominatim) and then collect the details for each result. Unfortunately, they use different functions to do this details lookup. For search you find it here: https://github.com/twain47/Nominatim/blob/753227ae255cbd71015b042a41dc3cbbfb8f1904/lib/Geocode.php#L366 and here (the part including polygon lookup) https://github.com/twain47/Nominatim/blob/753227ae255cbd71015b042a41dc3cbbfb8f1904/lib/Geocode.php#L1597 For reverse this code is used: https://github.com/twain47/Nominatim/blob/753227ae255cbd71015b042a41dc3cbbfb8f1904/lib/PlaceLookup.php The simple solution would be to copy the polygon code over from search to reverse. The nice one would be to unify these two parts of the code and make sure search uses PlaceLookup which then should be doing the fancy polygon stuff. Once the lookup work, the output templates need to be adapted. Again, search provides the examples: https://github.com/twain47/Nominatim/blob/753227ae255cbd71015b042a41dc3cbbfb8f1904/lib/template/search-xml.php#L44 https://github.com/twain47/Nominatim/blob/753227ae255cbd71015b042a41dc3cbbfb8f1904/lib/template/search-jsonv2.php#L56 https://github.com/twain47/Nominatim/blob/753227ae255cbd71015b042a41dc3cbbfb8f1904/lib/template/search-json.php#L57 And again, copying it over is the easy solution and factoring out the code would be the nice one. Sarah _______________________________________________ Geocoding mailing list [email protected] https://lists.openstreetmap.org/listinfo/geocoding

