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

Recent Posts

The Beginning of CVOYA

There’s a unique energy that comes with starting something new — a blend of excitement,…

3 weeks ago

Enhancements in Graph Model: Dynamic Entities & Full-Text Search

As I continued work on BrainExpanded and its MCP service, I came to realize that…

4 months ago

GraphModel: A .NET Abstraction for Graphs

Just over a month ago, I published "Playing with graphs and Neo4j". Back then, it…

5 months ago

Playing with graphs and neo4j

After my initial implementation of some BrainExpanded-related ideas on top of dgraph using its GraphQL…

6 months ago

A Graph Model DSL

Say hello to the Graph Model Domain Specific Language (GMDSL), created with the help of…

6 months ago

BrainExpanded – Web app and Data Sources

As I wrote in previous posts, the manual recording of memories for BrainExpanded is just…

7 months ago