Newsflash

Registered Users!  Registered users can now demo the Beta maps being developed.  Click on "Latest Test Page" in the user menu to the left after logging in.  These maps may display incorrectly, have fun!
 
Ship Plotting Forum
July 23, 2008, 12:12:32 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can now use Custom Charts in ShipPlotting
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Define Map View  (Read 934 times)
Andy
Newbie
*
Offline Offline

Posts: 2


View Profile
« on: January 24, 2008, 09:05:23 AM »

I've been playing with the Google script on an old computer of mine.  How do I define which type of map loads? I looked at the java file and didn't see a way to define it. I'd like to have the satellite view (G_SATELLITE_MAP) rather than the default view.

Also, was there any progress made on changing the icons to look like ships instead of the default google pointers?

Thanks!
Logged
Administrator
Administrator
Jr. Member
*****
Offline Offline

Posts: 88


View Profile
« Reply #1 on: January 24, 2008, 07:27:32 PM »

Andy,

Here is what google has to say in their docs.

Code:
Map Attributes

By default, maps show up within the Google Maps API using standard "painted" tiles. However, the Google Maps API also supports other maps types. The following map types are standard:

    * G_NORMAL_MAP- the default view
    * G_SATELLITE_MAP - showing Google Earth satellite images
    * G_HYBRID_MAP - showing a mixture of normal and satellite views
    * G_DEFAULT_MAP_TYPES - an array of these three types, useful for iterative processing

You can set the map type using the GMap2 object's setMapType() method. For example, the following code sets the map to use the satellite view from Google Earth:

  var map = new GMap2(document.getElementById("map_canvas"));
  map.setMapType(G_SATELLITE_MAP);

A map also contains a number of attributes that are useful to ascertain. For example, to find the dimensions of the current viewport, use the GMap2 object's getBounds() method to return a GLatLngBounds value.

So if you look in the map_functions.js script in the files you will need to find this section:

Code:
//Runs the function below (gbrowsercompat) and then loads the google map.
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new PromoControl());
map.setCenter(new GLatLng(slat, slon), zlvl);
map.openInfoWindowHtml(map.getCenter(), (map_desc));

Change it to:

Code:
//Runs the function below (gbrowsercompat) and then loads the google map.
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));

map.setMapType(G_SATELLITE_MAP);

map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new PromoControl());
map.setCenter(new GLatLng(slat, slon), zlvl);
map.openInfoWindowHtml(map.getCenter(), (map_desc));

That should do it.  You can also change the G_SATELLITE_MAP to any of the other types listed in the documentation above.

Let me know if works out for you.
Logged

Andy
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #2 on: January 25, 2008, 07:12:43 AM »

Thanks, I wasn't sure if I could just add that line.
Logged
Administrator
Administrator
Jr. Member
*****
Offline Offline

Posts: 88


View Profile
« Reply #3 on: January 25, 2008, 05:23:17 PM »

Yep, that's it.

You can add any of the other map types as well.

Aric
Logged

Pages: [1]   Go Up
  Print  

 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
© 2008 ShipPlotting.com