blockchain-http icon indicating copy to clipboard operation
blockchain-http copied to clipboard

Add "bounding box" (swlat, swlon, nelat, nelon) values for cities

Open danielcolinjames opened this issue 4 years ago • 3 comments

I'm not sure about the feasibility of this, but here's what I'm trying to do on the frontend:

For a given city (using the city_id value), allow someone to link directly to the coverage map of a certain city, e.g. going to a URL like: https://explorer.helium.com/coverage/cities/:city_id would load up the coverage map centered on that city_id to show the coverage there

I think right now the only way I can see to do it is do a request for https://api.helium.io/v1/cities/:city_id/hotspots and then either loop through all hotspots to get the max/min lat/lon, or pick a random hotspot (or the average of a random sample of hotspots) as a "center" lat/lng value, and then set some reasonable zoom level.

It would be really great if it was possible to get a "bounding box" (swlat, swlon, nelat, nelon) for all hotspots in a given city, so that I could use that as the "frame" to load up in the coverage map. I'm picturing kind of the opposite of this:

/v1/hotspots/location/box with query params swlat, swlon, nelat, nelon to return hotspots within a given geographic boundary

Let me know if you think that might be doable, or if some other solution on the frontend might be better.

danielcolinjames avatar Mar 29 '21 18:03 danielcolinjames

talked with bones and he thought of a potentially much easier way to do this—is it possible to get a lat/lng for each cityId on the API side and send it back with city data from /cities?

danielcolinjames avatar Apr 02 '21 18:04 danielcolinjames

talked with bones and he thought of a potentially much easier way to do this—is it possible to get a lat/lng for each cityId on the API side and send it back with city data from /cities?

not sure I'm understanding it all.. multiple h3 locations for hotspots translate to the same city_id.. i.e. multiple lat/lons. You're asking for a single lat/lon that represents a city_id?

madninja avatar Apr 03 '21 02:04 madninja

yeah if that's possible. not sure what it looks like on the geocoding side but was hoping there was some way we could associate each city_id with a lat/lon that we could use as a center point to snap the map to

if there are several h3 locations that translate to the same city_id that would be workable too if they came back as an array attached to that city_id

I'm just trying to create a way to "link" directly to a given city_id on the map, so whatever's easiest on your side that would give me a lat/lon (or a set of them, or a ne_lat, ne_lon, sw_lat, sw_lon) associated with a city_id would be great :)

danielcolinjames avatar Apr 03 '21 03:04 danielcolinjames