Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker doesn't show up when result has bbox property #129

Closed
hanbyul-here opened this issue Jun 6, 2016 · 5 comments
Closed

Marker doesn't show up when result has bbox property #129

hanbyul-here opened this issue Jun 6, 2016 · 5 comments
Milestone

Comments

@hanbyul-here
Copy link
Contributor

  • Marker is not showing up (v 1.6.2) when there is bbox property, even if its geometry is Point

example one : https://search.mapzen.com/v1/autocomplete?text=tisch%20school%20of%20the&focus.point.lat=40.721502075213955&focus.point.lon=-74.00527954101564&api_key=search-MKZrG6M

(this doesn't show a marker)

@hanbyul-here hanbyul-here changed the title Marker doesn't show up when it has bbox property Marker doesn't show up when result has bbox property Jun 6, 2016
@louh
Copy link
Contributor

louh commented Jun 9, 2016

I think it's a backward compatibility thing, but all search results have a geometry of Point no matter what. A bbox property exists when the source geometry is actually an area. In this case, it looks like the Tisch School of the Arts in OSM (https://www.openstreetmap.org/way/247842670) is tagged to an area and not a node, so that's where the bbox is coming from.

Once Mapzen Search started returning bboxes, I opted not to display markers for them, since showing a point marker for large areas might be misleading. It's a pretty simplistic model, but perhaps we should think through what we expect the behavior to be (should markers be displayed when bboxes are very small?) and what makes sense in terms of making it easy to tweak and how to document it.

@hjmccain
Copy link

hi @louh! is there a way to force markers to display for all locations, including large areas / locations w/ bbox attribute? i am finding that certain locations are erroneously given the bbox property (i.e. a bagel shop in my neighborhood) — when some restaurants show up with markers and others don't, the performance feels inconsistent — i'd rather have everything show up with a marker (even if the marker might feel a bit arbitrary for larger areas).

@louh
Copy link
Contributor

louh commented Feb 23, 2017

Hi @hjmccain, we haven't revisited this issue, so there's currently no option to force markers to display for all locations regardless of bbox. But here's one strategy to manually add a marker with some additional code:

// Assign your geocoder instance to a variable
var geocoder = new L.Control.Geocoder('<your-api-key>');

// Listen for selections
geocoder.on('select', function (event) {
  // If the feature has a bbox, it probably only got the bbox, so add a marker
  if (event.feature.bbox) {
    geocoder.showMarker(event.feature.properties.label, event.latlng);
  }
});

I haven't tested this, but I believe this should work. The one caveat I can think of is that this doesn't automatically drop markers if you use the up/down arrow keys through the result list, but only activates when a result is selected by clicking on it or pressing Enter on it.

@louh louh modified the milestone: 1.8.0 Mar 7, 2017
@louh
Copy link
Contributor

louh commented Mar 7, 2017

New things to try:

  1. we should only display bbox for polygonal results. point results like venues and places should display a marker even if the bbox property is returned.
  2. a "force-marker" option should be provided anyway.

Acceptance test cases:

  1. a polygon result zooms to bbox
  2. a point result without a bbox drops a marker
  3. a point result that contains a bbox will still drop a marker
  4. when forceMarker is true, a polygon result with a bbox drops a marker on its given point

@louh
Copy link
Contributor

louh commented Mar 9, 2017

We're implementing this as of f5de53b.

  • Results from the venue and address layers will always drop markers, regardless of whether bbox data is present
  • A convenience option, named overrideBbox, allows a geocoder to ignore all bboxes and drop markers if the markers option is true (it is by default).

This will be released in 1.8.0.

@louh louh closed this as completed Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants