whosonfirst / whosonfirst-www-api

4 stars 2 forks source link

Feature request: ability to return nearby cities (using places.getNearby with a radius > 500m) #56

Open simonw opened 7 years ago

simonw commented 7 years ago

I'd like to be able to find all cities near a specific city - e.g. what are the closest cities to San Francisco.

The obvious way to do that would be using whosonfirst.places.getNearby - like so:

https://whosonfirst-api.mapzen.com/?method=whosonfirst.places.getNearby&latitude=37.777228&longitude=-122.470779&api_key=mapzen-xxx&placetype=locality&radius=500

That's feeding it placetype=locality and a latitude and longitude.

Problem: the maximum allowed radius is 500m! For my use-case I'd like to be able to pass a radius of around 100 miles instead.

Feature request: any chance of increasing the allowed radius for places.getNearby to cover this use-case? Or is there another API method I should be looking at instead?

simonw commented 7 years ago

It looks like the relevant code is here: https://github.com/whosonfirst/whosonfirst-www-api/blob/0b8c5a2bdec90b833b39045543674fd43ab4f12b/www/include/lib_api_whosonfirst_places.php#L671-L676

thisisaaronland commented 7 years ago

I will do this for you only if you promise me you are rebuilding Dopplr!

This sounds reasonable and I will have a look in the morning.

thisisaaronland commented 7 years ago

Okay, because I am a nostalgic child I've bumped the limit to 50M or 80467m. For two reasons:

  1. Dopplr
  2. I'd like to ask you to poke at things as you normally would, with the increased limit, in order to stress test things.

I'd be open to upping the limit again but I'd like to do in stages. Does that work for you?

simonw commented 7 years ago

Absolutely! Thanks very much. I plan to hit https://whosonfirst-api.mapzen.com/?method=whosonfirst.places.getNearby&latitude=37.686263&longitude=-122.46846&api_key=mapzen-xxx&placetype=locality&radius=80467&extras=gn:population,geom:latitude,geom:longitude and then do an in-memory Python sort to pick out the results that are both closest AND have a decent sized population (based on gn:population)