graphhopper / geocoder-converter

Converts arbitrary geocoding responses to a GraphHopper response
https://graphhopper.com/api/1/docs/geocoding/#external-providers
Apache License 2.0
9 stars 11 forks source link

Make query working #1

Closed karussell closed 8 years ago

karussell commented 8 years ago

Adding q and limit parameter to forward to nominatim

It looks like city is null in the response (?)

Also I've not yet seen how to make q required.

boldtrn commented 8 years ago

Thanks @karussell

It looks like city is null in the response (?)

I will check that, thanks.

Also I've not yet seen how to make q required.

You mean how to set it required dropwizard?

I will merge this PR and work on this a bit more.

boldtrn commented 8 years ago

@karussell I just found why in some requests the city is null. Nominatim can return three different city like values city, town, village. The GHResponse only contains only city. So I think we should return the town if no city is available and return the village if no town is available. Or we could do it vice versa and starting from village. If no village is given we return the town. if no town is given we return the city. I am not sure if it can happen that more than one value is given. Haven't found an example yet.

Other results e.g. this here has no City result (from here: http://nominatim.openstreetmap.org/search/?q=berlin&limit=5&format=json&addressdetails=1):

{
place_id: "144798857",
licence: "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
osm_type: "relation",
osm_id: "62422",
boundingbox: [
"52.3382449",
"52.6754755",
"13.0883476",
"13.7611541"
],
lat: "52.5198535",
lon: "13.4385964",
display_name: "Berlin, Deutschland",
class: "boundary",
type: "administrative",
importance: 0.92214979763087,
icon: "http://nominatim.openstreetmap.org/images/mapicons/poi_boundary_administrative.p.20.png",
address: {
state: "Berlin",
country: "Deutschland",
country_code: "de"
}
},
karussell commented 8 years ago

Sounds reasonable. Also i would choose city->town->village fallback direction.

boldtrn commented 8 years ago

@karussell Sounds great. I just added it like this. cheers :)