Google Explorer HELP!!!!

General discussion about Scenery Design. Questions about SBuilder for Flight Simulator FS2004.
Post Reply
rhumbaflappy
Posts: 420
Joined: Sat Oct 16, 2004 10:11 pm

Re: Google Explorer HELP!!!!

Post by rhumbaflappy » Sat Nov 22, 2008 11:49 am

Google has most probably changed their API. Perhaps Luis can alter the code of his website.

Dick
Dick

Robbert
Posts: 16
Joined: Fri Nov 21, 2008 4:46 am

Re: Google Explorer HELP!!!!

Post by Robbert » Sat Nov 22, 2008 6:58 pm

Sibs6 wrote:Thanks Dick
That would really be great if Lou could look into it.
This is an excillent tool and would really hate to loose it.

Al
Flight Ontario
I agree !!! I'm totally dependent on this tool to fix and realign airports in South Africa

User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Re: Google Explorer HELP!!!!

Post by Luis Sa » Mon Nov 24, 2008 3:17 am

Hello,

I checked the web page and I really discover an error. I do not know why it was working OK in the first place! But I think it should work fine again.

You can use:

http://www.ptsim.com/sbuilder/gmaps.htm

or

http://www.ptsim.com/sbuilder/gmaps.asp ... n=-73.8752

In the second case you will start on a specific location. You can set this location according to your airport and, maybe, save this URL in your desktop. Next time you need to use the tool you will start in the right place instead of that little Portuguese airfield!

Kind Regards,

Luis

rhumbaflappy
Posts: 420
Joined: Sat Oct 16, 2004 10:11 pm

Re: Google Explorer HELP!!!!

Post by rhumbaflappy » Mon Nov 24, 2008 3:11 pm

Hi Luis.

This works fine. :)
I wonder if you could include the google terrain view as well? Ther may be some use for it.

Dick

P.S.

There are 2 threads on the SBuilderX forum that need to be deleted and their posters banned.
Dick

User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Re: Google Explorer HELP!!!!

Post by Luis Sa » Mon Nov 24, 2008 4:27 pm

Hi Dick,

Thanks for calling my attention to those posts. I deleted them but was not able to see the posters. In fact I have little experience in forum administration.

Regarding the views, I tried that but without success. May be you (or another person) could help. Here is my problem:

1) You can see the code of gmaps.htm using the "View Code" in your browser. If you do that you will see that I use a a variable called type. This variable is set to zero when the map loads. Then I listen to the event maptypechanged and when the event fires, type toggles between 0 and 1 as it can be seen here:

Code: Select all

		GEvent.addListener(map, 'maptypechanged', function() {
			type = type + 1
			if (type == 2 ) {type = 0}
			document.getElementById("MapType").value=type
		}); 
The last line puts the value of variable called type in a hidden Textbox whose "Id" is MapType. When you press the button labelled "NewMap" you are actually sending a http form to be serviced by the newgmap.asp page that exists in my web site. That asp page reads the MapType value passed by the gmaps.htm page (and also the center latitude and longitude, zoom, and size of the new window) and creates a new Google map based on that data. If you view the code of the newgmap.asp page (you can only see the html part) you would see this code:

Code: Select all

	function onLoad(CLon,CLat,Zoom,Type)
	{ 
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(CLat, CLon), Zoom);
		if (Type == 0)  { map.setMapType( G_SATELLITE_MAP ) }
		else  { map.setMapType( G_NORMAL_MAP ) };
	}
I said you WOULD SEE because I will change that right now to:

Code: Select all

	function onLoad(CLon,CLat,Zoom,Type)
	{ 
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(CLat, CLon), Zoom);
		if (Type == 0)  { map.setMapType( G_SATELLITE_MAP ) };
		if (Type == 1)  { map.setMapType( G_NORMAL_MAP ) };
		if (Type == 2)  { map.setMapType( G_HYBRID_MAP ) };
	}
and that is what you will see. Therefore the problem is to get the type of map and set type =0 =1 or =2 according. In the Google API documentation:

http://code.google.com/apis/maps/docume ... html#GMap2

there is a method to read the type of the map but I was not able to use it. So I have created that very crude routine that only toggles type between 0 and 1. If you are able to set type = 0 =1 or =2 depending on the current maptype I will change the gmaps.htm.

If you want to dig into this problem, you can save the gmaps.htm page in your disk. Then you need to change the line that reads:

Code: Select all

<form id="form1" method="post" action="newgmap.asp" target="blank">
to look like:

Code: Select all

<form id="form1" method="post" action="http://www.ptsim.com/sbuilder/newgmap.asp" target="blank">
If you do that, you can debug this problem from your disk and still use the ASP page that sits in my server. Note that when you call gmaps.htm from your disk you can even delete the API key but that is not relevant.

Regards,

Luis

User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Re: Google Explorer HELP!!!!

Post by Luis Sa » Mon Nov 24, 2008 4:30 pm

Hello again,

It could be useful to post the complete contents of the file newgmaps.asp. Here it is:

Code: Select all

<% Response.Buffer = True

dim width
dim height

size = Trim(Request.Form("newMapSize"))
CLatitude = Trim(Request.Form("CLatitude"))
CLongitude = Trim(Request.Form("CLongitude"))
zoom = Trim(Request.Form("Zoom"))
maptype = Trim(Request.Form("MapType"))

if size = 1 then
	width = 1600
	height = 1200
	zoom = zoom + 1
end if
if size = 2 then
	width = 3200
	height = 2400
	zoom = zoom + 2
end if

%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Exploring Google Maps</title>
    <script src="http://maps.google.com/maps?file=api&v=2.87&key=ABQIAAAADLLz3BUKnQT_SGoE5J5NyxQsYYhidpBt0-g-SE1Lm_zYfMVTjRTcaCIU5kmDCIUYlm9l3kJNkFePFA" type="text/javascript"></script>
    <script type="text/javascript">
    
	function onLoad(CLon,CLat,Zoom,Type)
	{ 
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(CLat, CLon), Zoom);
		if (Type == 0)  { map.setMapType( G_SATELLITE_MAP ) };
		if (Type == 1)  { map.setMapType( G_NORMAL_MAP ) };
		if (Type == 2)  { map.setMapType( G_HYBRID_MAP ) };
	}

    </script>
  </head>
<body onload="onLoad(<%=CLongitude%>,<%=CLatitude%>,<%=zoom%>,<%=maptype%>)" onunload="GUnload()">
<DIV id="map" style="LEFT: 0px; WIDTH: <%=width%>px; POSITION: absolute; TOP: 0px; HEIGHT: <%=height%>px"></DIV>
</body>
</html>
Kind Regards,

Luis

Robbert
Posts: 16
Joined: Fri Nov 21, 2008 4:46 am

Re: Google Explorer HELP!!!!

Post by Robbert » Mon Nov 24, 2008 7:58 pm

Luis

Thanks for fixing the error we really appreciate it ! :D

rhumbaflappy
Posts: 420
Joined: Sat Oct 16, 2004 10:11 pm

Re: Google Explorer HELP!!!!

Post by rhumbaflappy » Mon Nov 24, 2008 7:59 pm

Hi luis.

For the terrain type map I find this clue:

map.addMapType(G_PHYSICAL_MAP);

map.setMapType(G_PHYSICAL_MAP);


Dick
Dick

User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Re: Google Explorer HELP!!!!

Post by Luis Sa » Sun Nov 30, 2008 4:36 am

Hello Dick,

Thanks for the suggestion. I have resolved the problem and made small changes. The "ASP URL" can be called with a Zoom argument like this:

http://www.ptsim.com/sbuilder/gmaps.asp ... 52&Zoom=14

I saw a post in Fsdeveloper saying that Google maps does not work in SBuilderX. Unfortunatelly I am not at home and I have not SBuilderX in my laptop. However as I was checking this "...gmaps.asp" I saw no reason why a DLL could be done. I will investigate this further.

Kind Regards,

Luis

User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Re: Google Explorer HELP!!!!

Post by Luis Sa » Sat Dec 20, 2008 10:23 pm

Hello,

I added the possibility to get backgrounds from Yahoo and LiveEarth in addition to Google. Please click on a link above and you will see 2 new buttons that take you to the other map providers.

In order to capture the larger background in the "new" window I found the following plugin for Firefox to be a "must". With a single click I place the whole picture (even the hidden part) in my disk:

https://addons.mozilla.org/en-US/firefox/addon/1146

May be there is something similar for Internet Explorer but I rarely use it now.

Kind Regards and Merry Christmas to all FS designers,

Luis

ps: please report possible bugs

rhumbaflappy
Posts: 420
Joined: Sat Oct 16, 2004 10:11 pm

Re: Google Explorer HELP!!!!

Post by rhumbaflappy » Sun Dec 21, 2008 7:54 pm

Hi Luis.

The new sources work fine! I'm using firefox with "FireShot" to capture the entire image. That addon also works well.

I'll try your reccomendation as well.

Dick
Dick

rhumbaflappy
Posts: 420
Joined: Sat Oct 16, 2004 10:11 pm

Re: Google Explorer HELP!!!!

Post by rhumbaflappy » Tue Dec 30, 2008 9:02 pm

Hi Luis.

Regarding the "terrain" image for Google Maps:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAjU0EJWnWPMv7oQ-jjS7dYxSPW5CJgpdgO_s4yyMovOaVh_KvvhSfpvagV18eOyDWu7VytS6Bi1CWxw"
      type="text/javascript"></script>

   <script type="text/javascript">
   function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addMapType(G_PHYSICAL_MAP);
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.addControl(new GMapTypeControl());
        map.addControl(new GLargeMapControl());
      }
    }

    </script>
  </head>

  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 500px; height: 300px"></div>
  </body>
</html>
Note... the version is as v=2.x This is the the newly approved manner to use the latest version automatically. The version should be the same for all the .asp programs as well.

map.addMapType(G_PHYSICAL_MAP); is added

and your code...

function onLoad() {

GridON = 0
type = 0
map = new GMap2(document.getElementById("map"));
map.addMapType(G_PHYSICAL_MAP);
map.setCenter(new GLatLng(CLat, CLon), Zoom);
map.enableScrollWheelZoom();
...


GEvent.addListener(map, 'maptypechanged', function() {
var myType = map.getCurrentMapType();
if (myType == G_SATELLITE_MAP ) { type = 0; }
if (myType == G_NORMAL_MAP ) { type = 1; }
if (myType == G_HYBRID_MAP ) { type = 2; }
if (myType == G_PHYICAL_MAP ) { type = 3; }
document.getElementById("MapType").value=type
});
...


..and that needs to be altered for newgmap.asp as well

Dick
Dick

User avatar
Luis Sa
Posts: 1736
Joined: Sun May 18, 2003 11:17 am
Location: Portugal
Contact:

Re: Google Explorer HELP!!!!

Post by Luis Sa » Tue Jan 06, 2009 1:17 am

Hello Dick,

Thanks for your suggestions. I will add the 4th type of maps to the Google web page (and of course on the large window page). I have been looking to portals (to add funcionality to this site) and I will make the modifications as soon as I finish that.

I will check the version note. Last time I looked into it, I found that I add problems with showing grid lines. If I note no problem with it I will change it as well.

Kind Regards,

Luis

NZ255
Posts: 7
Joined: Mon Jun 29, 2009 5:08 am

Re: Google Explorer HELP!!!!

Post by NZ255 » Sun Aug 30, 2009 4:15 am

Are you ale to make the zoom level go past 20? I want to capture images at level 21 as data exits for that level but even if I enter 21 in the zoom in the URL, it doesn't zoom that far in:

http://www.ptsim.com/sbuilder/gmaps.asp ... 25&Zoom=21
You can still scroll in a notch further. And when you are at full zoom in the smaller window, if you open a 3200 x 2400 window it displays level 20

Thanks sorry if it's confusing,

Nick

Robbert
Posts: 16
Joined: Fri Nov 21, 2008 4:46 am

Re: No Backgrounds from Google !!

Post by Robbert » Sat Sep 26, 2009 3:41 pm

Hi Luis

Has Google changed their API again, for the last few days I can't get any tiles downloaded from Google ?

Greetings

Post Reply