How to load my appl with google maps as base map even without internet conection

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to load my appl with google maps as base map even without internet conection

Rodolfo Moreno
Hi All,
I have an application that has to google maps as base map (I am using Fusion viewer). When the application loads in a machine with internet conection the application works fine however when the application loads in a machine without internet conection the application hangs out.
What I would like to do is that the application loads even if the machine has not conection internet. The app should detect automatically that there is no internet conection and it should load the others layers without problem.
How could I achieve this functionality?
My enviroment: Mapguide 2.5 + .NET 4.0 + Fusion viewer. My layers are stored in SQL 2012
Thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: How to load my appl with google maps as base map even without internet conection

Hans Milling
Do you have MapGuide and SQL server on the offline machine? You need to have this or else you will not have any contact to the servers while offline. I believe that the map should still work then even though there is no connection to the google map.

Best regards
  Hans Milling...
Reply | Threaded
Open this post in threaded view
|

Re: How to load my appl with google maps as base map even without internet conection

Rodolfo Moreno
Hans,
Mapguide and the SQL Server are in the same offline machine. What I have seen when I debug in the browser is that fusion viewer first does the request to google maps and how there is no response the viewer hang out.
Best Regards,
Reply | Threaded
Open this post in threaded view
|

Re: How to load my appl with google maps as base map even without internet conection

GordonL
Perhaps make 2 layouts.  1 with Google map and 1 without.

You can have a start page to check for google - perhaps with jQuery:


$.ajax({
    type: 'HEAD',
    url: 'http://www.google.com',
success: function()
{
        var myUrl="/mapguide/fusion/templates/mapguide/aqua/index.html?ApplicationDefinition=Library://Samples/Sheboygan/FlexibleLayouts/Aqua.ApplicationDefinition&locale=en";
      $(location).attr('href',myUrl);
},
error: function()
{
      var myUrl="/mapguide/fusion/templates/mapguide/aqua/index.html?ApplicationDefinition=Library://Samples/Sheboygan/FlexibleLayouts/Flat.ApplicationDefinition&locale=en";
      $(location).attr('href',myUrl);
}
});
Reply | Threaded
Open this post in threaded view
|

Re: How to load my appl with google maps as base map even without internet conection

Rodolfo Moreno
Thanks Gordon.
I tried your suggestion. Your code always is showing that there is not internet conection even if internet conexion exist.
What it could be failing?
Regards,
Reply | Threaded
Open this post in threaded view
|

Re: How to load my appl with google maps as base map even without internet conection

GordonL
It might be a cross-domain issue.  You need JSON so replace the URL with this one:


url: 'https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA',