Categories: TechnologyWeb

Zoom buttons for the Google Maps control on the iPhone

It took me few hours, spread over a number of weekends, to figure out the solution to the following problem so I am recording it in case it’s useful to someone else out there.

I am using PhoneGap, jQuery Mobile, and the Google Maps control for a mobile app I am building. While I was debugging the app using Chrome on my MacBook, the control was configured exactly as I wanted it. It looked like this…

Note the zoom in/out buttons at the top-left. Exactly what I wanted. However, when running the same code on the iPhone, those same buttons weren’t coming up 🙁

Here’s the code I original used to initialize the Google Maps control…

$('#map').gmap({
    'zoom': 13,
    'mapTypeControl': false,
    'navigationControl': true,
    'streetViewControl': false,
    'disableDefaultUI': true,
});

And here’re the few more options I had to introduce in order to make the zoom buttons appear on the iPhone as well.

$('#map').gmap({
    'zoom': 13,
    'mapTypeControl': false,
    'navigationControl': true,
    'streetViewControl': false,
    'disableDefaultUI': true,
    'zoomControl': true,
    'zoomControlOptions': {
        'position': google.maps.ControlPosition.TL,
        'style': google.maps.ZoomControlStyle.SMALL
    }
});

Even though I asked for the position to be at the “top-left”, they still appear at the bottom but at least they are there now 🙂 Oh, and they do look different, which is good since on iPhone the buttons need to be different. So I am guessing that the Google Maps control is doing different things based on the browser/environment it detects.

I found the solution by trying the relevant options listed in Google’s documentation for maps.

Savas Parastatidis

Savas Parastatidis works at Amazon as a Sr. Principal Engineer in Alexa AI'. Previously, he worked at Microsoft where he co-founded Cortana and led the effort as the team's architect. While at Microsoft, Savas also worked on distributed data storage and high-performance data processing technologies. He was involved in various e-Science projects while at Microsoft Research where he also investigated technologies related to knowledge representation & reasoning. Savas also worked on language understanding technologies at Facebook. Prior to joining Microsoft, Savas was a Principal Research Associate at Newcastle University where he undertook research in the areas of distributed, service-oriented computing and e-Science. He was also the Chief Software Architect at the North-East Regional e-Science Centre where he oversaw the architecture and the application of Web Services technologies for a number of large research projects. Savas worked as a Senior Software Engineer for Hewlett Packard where he co-lead the R&D effort for the industry's Web Service transactions service and protocol. You can find out more about Savas at https://savas.me/about

Share
Published by
Savas Parastatidis

Recent Posts

Digital Twin (my playground)

I am embarking on a side project that involves memory and multimodal understanding for an…

2 months ago

“This is exactly what LLMs are made for”

I was in Toronto, Canada. I'm on the flight back home now. The trip was…

9 months ago

AI is enhancing me

AI as an enhancer of human abilities.

10 months ago

“How we fell out of love with voice assistants”

The BBC article "How we fell out of love with voice assistants" by Katherine Latham…

1 year ago

Ontology-based reasoning with ChatGPT’s help

Like so many others out there, I played a bit with ChatGPT. I noticed examples…

1 year ago

Break from work

Hi all… It’s been a while since I posted on this blog. It’s been an…

2 years ago