mysociety / planningalerts-app

Find out and have your say about what's being built and knocked down in your area.
www.planningalerts.org.au
Other
0 stars 1 forks source link

Search returns values but not in view #159

Closed stanleyk79 closed 10 years ago

stanleyk79 commented 10 years ago

Not sure if possibel to zoom to extent of search results in map view - saves user seeing nothing if outside map zoom level

stevenday commented 10 years ago

Note to self: It looks like this is possible with the google maps API via something like:

var bounds = new google.maps.LatLngBounds();
$.each(markers, function(index, marker) {
  bounds.extend(marker.getPosition());
}
map.fitBounds(bounds);

@stanleyk79 - The tricky thing is that, by default, we zoom in quite far so that the map is (hopefully) instantly recognisable to the user as being centered where they searched. Ideally we'd reverse the problem here and let the map drive, so that we only search for applications within the viewable map. However, it's hard to search for things that are exactly within the map because we don't know how much map someone will see until they've loaded the page. Furthermore, the map is always rectangular, whilst we can only search within a certain radius of a centre point.

There are a couple of ways to solve this, some harder than others, we've ticketed the simplest solution already at #139 which is just to search in a smaller radius so that it usually matches what you can see on the map, but this is another option and there is a third that's a bit out of scope at the moment. Something to discuss on Monday perhaps...

stevenday commented 10 years ago

Considering the (lack of) time we have left, I think #139 is going to be the best option here, from a quick play a radius of somewhere between 1/2 - 1/4 of a mile, rather than 2 miles is much more logical.

Therefore, closing this in favour of #139