How can I run a google maps request offline? - google-maps

I'm making a visualization using google maps. However, I have to make many direction requests to google maps.
Is there a way to "download" a section of a map, along with all its bus/car/bike routing information, so the direction requests can be done locally?
If it's possible, can you give a rough example to get me in the right direction?
Thanks :)

No there's no offline access to the Maps API, for either viewing tiles for associated services like routing/directions.
Additionally, you must always ensure the results of these types of requests are displayed on a Google map (which must be publicly available for free, according to the terms of service).
If you are looking for the ability to do offline routing with your own dataset, there are a number of open source routing engines available.

Related

Is there a platform agnostic HTML5 map service?

I have a Blazor combined client/server side app that uses HTML5 geolocation to return the user device latitude/longitude. I'd like to be able to provide the general "area" the user is in - a bit of a confirmation to the user the thing is working; and someday potentially enable the user to get lat/long for other locations as well. I have not been able to find a native HTML5 map service to go along with its geolocation capabilities, and in fact nearly every search leads to how to connect to Google Maps. I'm using Blazor, though, because I want the app to run and function on essentially every browser, so want to avoid Google Maps or Apple Maps, etc. I also checked quick on GitHub for potential API solutions but didn't see any. Ideas? Thanks!

Is there a traffic API for desktop apps?

I help develop a desktop app that displays map information with various layers on top. Now we want to add the Google Maps traffic layer. We do have a developer API key.
How can I use the Google API without a website, to generate just the data layer I need and download it in KML or GeoRSS or any other format so I can use it in the desktop app on top of my own map?
We already use the distance matrix, geocode, and directions API. Is there a traffic API as well, or are traffic data only available for embedding on a website?
Traffic data is not available as separate API. You can only use TrafficLayer of Maps JavaScript API or Android SDK.
There is a feature request in Google issue tracker to expose these data as an API:
https://issuetracker.google.com/issues/36537583
However, it looks like Google didn't set high priority on this task. Feel free to star the feature request to add your vote and subscribe to notifications from Google.
I hope my answer clarifies your doubt.

For Developing Location based reminder mobile app, which one is good..... Google Maps or Nokia maps

I am developing GPS based Location reminder in j2me. I am little bit confuse to which maps i use??.....Google maps & Nokia maps. Which one allows me good working... The working of my app are as follows :-
-User will provide a string to app to search a place of his/her desire.
-Then according to given string app will show a place on map by pointing marker on map.
-User can save that place or he/she can select a near by place rather than searched place by clicking on map or any other way.
-app will save that searched place coordinates & remind when it reached to near that place.
-When app remind to user about already stored place... that place should show on map by pointing an marker along with the how far he is from his destination.
The real choice here lies in whether to use a RESTful API like the Google Static Maps (or Nokia's RESTful Maps) or to use a native Java ME mapping library plugin such as the Nokia Maps API for Java ME. The latter has several major advantages:
Static mapping services such as the Google Static Maps API or Nokia's
RESTful Map API do not cache or tile the images when requested,
therefore each request involves a round trip to the server. If the
map on a mobile application needs to be refreshed at any time, using
a caching library will result in a reduction in network traffic after
around three maps have been displayed. An explanation of this can be
found here
As the name implies, Google's Static Maps API can only retrieve over
http static images for a requested coordinate point, image size,
image type and zoom level. Newer libraries offer additional
functionality out of the box offering dynamic Map content and touch
support, where the user can move around his/her current position,
zoom in, zoom out, modify the view mode to satellite or translate an
address to a coordinate point and show that on the map, among others.
This abstraction of the underlying functionality is hidden from the
developer so much less coding is needed in order to achieve the same
result .
Terms and Conditions for Nokia Maps are easier to fulfil than
Google - No legal restrictions of using the API outside a web browser
application or need to provide a link to the native Google Maps App
(if there is one), or to Google Maps (if there isn't one).
Nokia currently offer higher free daily request limits. Nokia Maps
API for Java ME supports up to 50,000 render requests per day and per
unique IP address (as of January 2012), for Nokia Developer
registered users (free of charge) while the limit for Google's Static
Maps API is currently 1000 unique (different) image requests per
viewer per day.
A couple of years ago there wouldn't be a choice, only RESTful solutions existed, but these days I would say a static http solution should only be used if you want a simple single image
As an abstraction of the underlying services, there are already a full set of examples to cover most of your use cases:
-User will provide a string to app to search a place of his/her desire.
-Then according to given string app will show a place on map by pointing marker on map.
http://www.developer.nokia.com/Commu...PI_for_Java_ME
-User can save that place or he/she can select a near by place rather than searched place by clicking on map or any other way.
Maybe you need to use a draggable marker:
http://www.developer.nokia.com/Devel...ples/#standard
Or react to the touch and find a Geocoordinate:
http://www.developer.nokia.com/Commu...PI_for_Java_ME
-app will save that searched place coordinates & remind when it reached to near that place.
This is known as geofencing and is covered by the Location API:
- http://www.developer.nokia.com/Resou...ty-events.html
-When app remind to user about already stored place... that place should show on map by pointing an marker along with the how far he is
from his destination.
Showing a Map with a Marker
http://www.developer.nokia.com/Devel...ples/#standard
For distance calculations, I guess you'd be after the ROUTING example
http://www.developer.nokia.com/Devel...mples/#routing
http://www.developer.nokia.com/Commu...g_with_Java_ME
Now you could re-write and all these services from scratch using RESTful APIs (and then go about debugging your code) , but I'm sure you'll agree it would be much easier to use an existing, working and tested framework for the low level plumbing and then just write your code on top using the services.
It is possible to encapsulate RESTful service in Java ME. As an example, added below is a screenshot from an app encapsulating the suggestion service
It is just a lot easier when someone else has already done this work for you and placed it in a library.

Using Google Maps V3 offline, e.g. with cache-manifest?

I'm writing an HTML5 mobile application that uses Google Maps V3 with a custom layer of OpenStreetMap tiles.
The OSM tiles (from tile.openstreetmap.org) are set to cache for just over 24 hours, and I'm using a cache-manifest for all my HTML/JS/CSS.
So the application could in theory be used offline, except the Google Maps interface isn't happy when offline.
It always wants to call to the Google Maps server at http://maps.google.com/maps/api/js?sensor=false&region=GB - when this fails, Google Maps fails to load.
Is there any way to use Google Maps V3 API offline?
Could I cache-manifest http://maps.google.com/maps/api/js?sensor=false&region=GB, or would that be a bad move?
(Sorry for this rather beginner question, let me know if I can explain better!)
Google coders themselves have tackled this problem and unfortunately the information isn't well disseminated. But yes you can use cache-manifest to do exactly what you've described.
Required Readings
First take a look at the Google Code blogpost here: http://googlecode.blogspot.com/2010/04/google-apis-html5-new-era-of-mobile.html
Then have a read at Missouri State's own post: http://blogs.missouristate.edu/web/2010/05/12/google-maps-api-v3-developing-for-mobile-devices/
The Technique
You must cache every URL used by Google Maps
Employ methods to battle Chrome's and Firefox's stubborn caching methods by removing it from "offline websites"
All customizations must be client-side in javascript
Your cache file will look like (as per Missouri State):
CACHE MANIFEST
/map/mobile/examples/template.aspx
/map/mobile/examples/template.css
/map/mobile/examples/template.js
NETWORK:
http://maps.gstatic.com/
http://maps.google.com/
http://maps.googleapis.com/
http://mt0.googleapis.com/
http://mt1.googleapis.com/
http://mt2.googleapis.com/
http://mt3.googleapis.com/
http://khm0.googleapis.com/
http://khm1.googleapis.com/
http://cbk0.googleapis.com/
http://cbk1.googleapis.com/
http://www.google-analytics.com/
http://gg.google.com/
Caveats
You will need to be entirely HTML5-based and recognize the impacts this will have on your users. This situation is handy where either your users are up-to-date on browser standards/devices or you have control over user choices.
Hope this helps.
I have http://maps.google.com/maps/api/js?sensor=false in the CACHE section of cache.manifest, together with my application files and there isn't any problem.
Although, I believe you also have to cache other files that the Google Maps API requests. You can take a look at the files downloaded by your app and include them.
Not possible!
Google map CDN URLs have dynamic nature,
https://mts0.googleapis.com/vt?pb=!1m4!1m3!1i8!2i234!3i15...
https://mts1.googleapis.com/vt?pb=!1m4!1m3!1i8!2i233!3i155!!...
No wildcard characters are allowed in CACHE section of the HTML5 cache manifest files
We can not have some thing like,
CACHE MANIFEST
/css/style.css
/js/libs/modernizr-2.0.6.min.js
/js/libs/jquery-2.1.4.js
http://mts0.googleapis.com/*
http://mts1.googleapis.com/*
http://fonts.googleapis.com/*
NETWORK:
*
I had a google map project that I needed offline. I found Bing Maps (https://www.bingmapsportal.com/ISDK/AjaxV7) is much better offline and switched my project over to that and I'm happy. I ran the google and bing version side-by-side in offline mode and Bing was great. Whereas google would immediatey fail on tile loads, Bing maps cached more tiles and appeared to even resize zoomed tiles to at least give you something in offline mode.
I know the question here is about Google maps; but if you don't care about bing vs. google and really just need offline support, I'd highly recommend trying Bing maps. It solved it for me.

Map controls for sites running https

A team I work with is currently in an unfortunate situation. They've spent a lot of time integrating the google map control on their site but they didn't discover that to run google maps on a https site you must license the control (and it isn't cheap) and the same goes for bing maps.
So my question is do you know of any cheaper/free map controls like google or bing maps?
OpenLayers
In version 3 of the API, HTTPS support is now free.
Why can't they put the google maps part on a non-secure page or frame? The google licence says that you must have it on a publicly accessible site to benefit from the free version of the licence, so even on a http site, you may still need to pay for the data.
All other mapping tools are dependant on the expensive map source data, so you'll not find any. The exception is OpenStreetMap which uses community-supplied map data.
MapQuest's API allows SSL usage through the free license.
I was looking into this and found this post - you can use Bing maps over ssl with no problems, and it seems to work fine.
For the danish users I found the following VisKort component on SoftwareBørsen. It looks like it is based on OpenStreetMap, but I'm not sure.