Google Maps with Mobile Web

You must Login before you can answer or comment on any questions.

Hi!

I understand that mobile web has GPS functionality working(great!), and I'd like to know if it is possible to integrate Google maps. The application basically needs to give driving directions to stored locations and search stored data by location.

Any help / suggestions would be awesome!

2 Answers

Accepted Answer

Yes, this should be possible. Ti.Map.View has a "userLocation" (bool) flag that you can enable that will draw a little blue dot showing the device's current location. This basically does all the hard work of listening to the GPS and drawing the dot.

To draw a route, you need to use the addRoute() method. The only inconvenient thing is the route is a list of lat/lng points that are used to construct a polyline. So, you would have to get that data from Google's Directions API.

The rest of the turn-by-turn data is easy to get. Here's an example from Google's Directions API docs that shows the "legs", the lat/lng of each leg, and instructions: http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false.

— answered 9 months ago by Chris Barber
answer permalink
3 Comments
  • Sounds great! And this would all work in the mobile web app, as well as the "native" Android and iOS apps?

    — commented 9 months ago by Zane Wright

  • Well, sort of. The mapping stuff should work just fine, however getting the direction data is going to be a little different. The problem is doing the cross-domain request to Google's servers. Web browsers have security that prevents them from downloading data from other domains.

    It can be remedied if the cross-domains have CORS enabled. I'm not sure if Google's servers have CORS enabled, so you may need to use a proxy server to relay the directions results. We usually setup a simple nginx proxy, but you could use Apache or write one in PHP or node.js.

    — commented 9 months ago by Chris Barber

  • Thanks for aall the help! Looks like I may need further help down the line though.

    — commented 9 months ago by Zane Wright

since mobile web is web... this should not be a problem, can you be more specific with your use case?

— answered 9 months ago by Aaron Saunders
answer permalink
1 Comment
  • Thanks for the response!

    The application will need to give driving directions to exhibition venues(their GPS coordinates stored on a server by administrators). Once in the exhibition venue, the application needs to give directions to exhibition stands via a floor map(Don't think that would use Google maps), and information on stands and their products etc.

    We need to do this through mobile web, as we need to support Blackberry and Windows Mobile devices as well as Android and iOS.

    — commented 9 months ago by Zane Wright

Your Answer

Think you can help? Login to answer this question!