How to Emulate Google Earth globe with Google Maps Javascript API? - javascript

Google Maps now includes an "Earth" setting similar to the Google Earth Plugin. I was hoping to replace the Google Earth Plugin with this feature since it has more modern touch interaction and is continually being updated, but it's not built into the Google Maps API so far as I can tell.
I've done a fair amount of searching on it, but I've only ever gotten results for the Google Earth Plugin API and the Satellite view in Google Map, which doesn't give me the 3D globe that I'm hoping for.
Is there any way to accomplish the Google Earth Style globe like Google has in a simpler way than drudging through and trying to make sense of the minified javascript on the Google Maps site?

No, at least not with the Google Maps API at the present time. 'Earth' is not one of the supported map types yet; see
https://developers.google.com/maps/documentation/javascript/reference#MapTypeId

Related

Google maps api Javascript 3D map

I am working on a development in which I have implemented the google maps Javascript api. As far as working on the 2D map is all very clear and documented, but I would love to know if there is any option or possibility to transform the map into 3D view which allows me to see 3D buildings, change tilt in view ... etc. Is there such a possibility ?.
No, Google Maps API only gives access to the 2D maps as well as Streetview.
3D maps and Google Earth is only available in google apps or the maps.google.com solution.

Show only 1 direction for Google Maps embed API

For a school project we are making an application that can track the location of a garbage truck.
To calculate the fastest direction for the truck we are using the Google Maps embed API, but there is one "problem". The API returns 3 optional directions but we only need one.
Is there an possibility to show only one direction, or do we need the JavaScript API of Google Maps then?
Thanks in advance.
I suggest using the Google Maps JavaScript API. I am using it for my website and it works like a charm, with many functionalities.

google maps offline: not tiles but javascript

I have an HTML (phonegap) application that uses Google Maps API to display a map with markers. I want this app to be used offline. I know that Google Maps tiles can't be used offline (because of its license). However, what I want to do is use the map interface without the tiles.
When online -> tiles and markers displayed.
When offline -> only markers displayed.
However, the js loading of Google maps is complex, and I haven't managed to cache it.
Thanks.
Caching google maps javascript is not allowed, that's because their payment system is based on how many times their javascript API are loaded by the users. One page refresh is equal to one google maps API call, and depending what kind of contract you made you just lost -1 from the total amount of API requests you have purchased.
How is Google Maps API for Business usage tracked and reported?
A single load of the Google Maps JavaScript API into a page. The
JavaScript API is reloaded every time a page that uses the API is
reloaded. User interactions with the map (eg. panning, zooming,
changing map types) do not generate more page views. Note however that
a page view is generated if the API is loaded into the page even if
the API is not then used to display a map.
See https://developers.google.com/maps/documentation/business/faq#pageview
You could, of course contact google and try to ask some tailored business solution for your needs. I am not 100% sure what kind of things they offer if you contact them directly. But although, your request is somewhat impossible to fill since those UI generation codes also resides inside that google maps API javascript which you need.
So I would suggest that if you only need google maps interface when offline, take a moment and implement something similar with HTML/CSS/ (and some JS).. markers you could draw on canvas or use normal img's and positioning. If you need to implement dragging and zooming - it would be little bit more difficult but not impossible with canvas or some other techniques. But that being said it would just be easier to keep app online, we all have internet :) ? Making 1on1 matching dummy offline UI against google maps would be really painful process, when we consider the fact that google maps UI also changes overtime, like in their upcoming versions.
You could use OpenStreetMaps instead, it can be used offline: http://wiki.openstreetmap.org/wiki/Offline_Openstreetmap

Google Maps api custom tiles for fictional video game world

I want to use the Google Maps v3 api to generate an interactive Google Map interface that uses custom tiles for a map from a video game. The app needs to be able to zoom-in out and display the proper tiles for each zoom level as well.
I'm looking for some resources or a tutorial on how to accomplish this. The Google Maps v3 API appears to only discuss using custom tiles that lay on top of the normal Google Maps tiles. That wouldn't make sense in my application since my map is for a fictional world and wouldn't line up with anything in the real world maps. Perhaps I'm just not seeing what I need in the API guide...
Check out the ImageMapType class in the reference. There's a nifty example showing Moon tiles.
One of my favourite applications is The Internet map, the developer wrote a pretty sweet article on how it was developed.
You need to either cut up your custom game map image into the appropriate file/directory structure that makes integration into Maps API easy (here's an example using Photoshop and some example HTML/JS code). Or use a more friendly tool like TileMill, but this expects data in a standard spatial data format and you probably don't have your game map stored in such a format. If you can go that route, they also provide a Node.js-based server called TileServe that makes integration a cinch.
If you are expecting a boatload of traffic, then maybe look at Google Maps Engine to host your custom game map image directly in Google's infrastructure.

Upgrading to v3 from v2 of google maps API, suggestions

I have full fledged integration of google maps version 2 in my web application, with features like get directions, cluster markers, tabbed info window, context menu(right click). The implementation has very poor design which is causing some problem, So now I need to revamp the core implementation to better design. I was thinking of upgrading to version 3 of google maps API. Please suggest, if that's a good thing to do and my all features will be running fine(or I will get replacement for all the features mentioned) in less time. Or should I stick to the version 2 of the google maps API?
I recommend you upgrade to v3. I upgraded my site a few months ago (and blogged about the experience). A few things to keep in mind:
No more API key.
The marker and info window API has changed, for the better.
No more AJAX helper stuff. If you are using GXMLHttp, you will need to swap over to a new AJAX wrapper (Jquery, mootools etc).
Check your lat/lngs are in the right order. GPoint takes x and y (longitude and latitude). v3 has a latlng object, so your params might be backwards.
Styled maps - You will be able to customize your color scheme in v3.
Don't think you can turn on the Google earth plugin in a single line of code like you could in v2 (not 100% on this, so please correct me if I am wrong).
Once you are done, you will be happy to make the change. Pages load faster, zooming is smoother (polyines scale as you zoom instead of disappearing) and the mobile experience is much better.

Categories