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

[Google Maps API] z zoom param presence causes map to be incorrectly placed #2340

Open
davidalejandroaguilar opened this issue Jan 21, 2025 · 5 comments
Labels
status: freezer Something we don't want to work on yet type: bug Something is broken

Comments

@davidalejandroaguilar
Copy link

The z zoom param on the ll param for the Geographic Location filtering is broken. It forces you to add a z character, otherwise Serpapi complains. However:

  • If you include it
    • The map is incorrectly placed.
  • If you don't include it
    • The map is correctly placed.

Google Maps URL example

With z param

https://www.google.com/maps/search/things+to+do+Bogota%2C+Colombia/@4.7110,74.0721,16z?hl=es-419

Image

Without z param
https://www.google.com/maps/search/things+to+do+Bogota%2C+Colombia/@4.7110,74.0721,16?hl=es-419

Image

Note It's worth mentioning that the zoom parameter on these Google Maps URLs doesn't seem to affect zoom in any way. e.g.

Without z param and setting it to 2

Produces the same result as above.

https://www.google.com/maps/search/things+to+do+Bogota%2C+Colombia/@4.7110,74.0721,2?hl=es-419
Image

SerpApi URL examples:

With z param

https://serpapi.com/playground?engine=google_maps&q=things+to+do+Bogota%2C+Colombia&ll=%404.7110%2C74.0721%2C14z&hl=es-419&type=search

Image

Without z param

https://serpapi.com/playground?engine=google_maps&q=things+to+do+Bogota%2C+Colombia&ll=%404.7110%2C74.0721%2C14&hl=es-419&type=search

Image

SerpApi Geographic Location param

Image
@davidalejandroaguilar davidalejandroaguilar added the type: bug Something is broken label Jan 21, 2025
@hilmanski
Copy link

Thank you for your report and for sharing your findings, @davidalejandroaguilar. We'll investigate this.

Just to point out, based on your example:

Without the z parameter:
https://www.google.com/maps/search/things+to+do+Bogota%2C+Colombia/@4.7110,74.0721,16?hl=es-419

The URL is adjusted to this after a few seconds https://www.google.com/maps/search/things+to+do+Bogota,+Colombia/@4.2820925,-74.2225269,351455m/data=!3m2!1e3!4b1?hl=es-419&entry=ttu&g_ep=EgoyMDI1MDExNS4wIKXMDSoASAFQAw%3D%3D

Whereas Google Maps uses m (meter) instead of z. We've logged this as well in this thread: #2196

@schaferyan
Copy link
Contributor

Another note that might be helpful @davidalejandroaguilar - when you include the data parameter, the map is displayed correctly:

https://serpapi.com/playground?engine=google_maps&q=things+to+do+Bogota%2C+Colombia&ll=%404.7110%2C74.0721%2C14z&hl=es-419&data=!3m1!4b1&type=search

@schaferyan schaferyan added the status: freezer Something we don't want to work on yet label Jan 21, 2025
@davidalejandroaguilar
Copy link
Author

davidalejandroaguilar commented Jan 22, 2025

Thank you all for chiming in, indeed adding the data param with !3m1!4b1 seems to fix it, except that the zoom doesn't seem to change much between single values, you have to change by 2 for the zoom to change, e.g.:

Image Image

Until I set 10z https://serpapi.com/playground?engine=google_maps&q=things+to+do+Bogota%2C+Colombia&ll=%404.7110%2C74.0721%2C10z&hl=es-419&data=!3m1!4b1&type=search

Image

Having said that, I guess this is indeed a "bug" that will be resolved until either the ll param allows not passing the z attribute or passing m?

Not sure what the proper solution is, since the above seems like a "hacky" workaround that doesn't respond well to the zoom param (it's either too zoomed in or too far away). I thank you for taking a look, however.

@hilmanski
Copy link

Thank you for sharing your findings @davidalejandroaguilar. We'll investigate it further.

I'm currently seeing a different behavior.

For 11z
Image

For 12z
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: freezer Something we don't want to work on yet type: bug Something is broken
Projects
None yet
Development

No branches or pull requests

3 participants