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

queryPlaceId parameter doesn't work #51

Open
hasfoug opened this issue Dec 30, 2021 · 3 comments
Open

queryPlaceId parameter doesn't work #51

hasfoug opened this issue Dec 30, 2021 · 3 comments

Comments

@hasfoug
Copy link

hasfoug commented Dec 30, 2021

I am currently working on integrating this into my application. I am specifying latitude and longitude along with the queryPlaceId parameter, as a result, I am getting navigated to the coordinates, but the place is not being selected (I need to tap on it manually).

My code is:

    open({
      latitude: lat,
      longitude: lon,
      zoom: 30,
      provider: 'google',
      queryPlaceId: googlePlacesId,
    });

I've tried without latitude and longitude, but it just opens the map with my current location in this case. The only working way for me to have the place preselected was to only query by name (without specifying the coordinates), but this leads to an issue that some places are not unique by name and I might get several results.

Thanks in advance!

@cnnrznn
Copy link

cnnrznn commented Nov 27, 2023

Ultimately, it looks like this param isn't used in link creation: https://github.com/brh55/react-native-open-maps/blob/main/index.js#L200-L251.

I'm facing the same issue, and will spend some time investigating how easy this would be to PR

Edit: it is used, but still investigating why it doesn't work

@cnnrznn
Copy link

cnnrznn commented Nov 27, 2023

@hasfoug it turns out this is completely the correct behavior. From the docs:

query_place_id (optional): A place ID is a textual identifier that uniquely identifies a place. For the search action, you must specify a query, but you may also specify a query_place_id. If you specify both parameters, the query is only used if Google Maps cannot find the place ID. If you are trying to definitively link to a specific establishment, the place ID is the best guarantee that you will link to the right place. It is also recommended to submit a query_place_id when you query for a specific location using latitude/longitude coordinates.

So, if you want to search, you have to supply the query param, but it will only be used as a fallback in case place_id cannot be found.

For my app, I'll use the place_description returned from the Places - Autocomplete API as the query string

@cnnrznn
Copy link

cnnrznn commented Nov 27, 2023

This issue, per my comment above, can probably be closed

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

2 participants