Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 622909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:02:08+00:00 2026-05-13T19:02:08+00:00

I have a google-maps mashup that worked fairly well with small test files –

  • 0

I have a google-maps mashup that worked fairly well with “small” test files – every file I generated, even for a 60 mile trip, was less than 16k.

Then, yesterday, a user sent me a KML file they were having problems with – it’s over 360k in size and, while it uploads okay, and when I call GGeoXML(), it appears to load into Google Maps okay, but no map appears and the error “Script error. (main.js,0)” appears in the log. This happens both in my own application and if I try to feed the kml file to Google’s “Code Playground” – but the file loads fine in Google Earth. If I re-save the file from Google Earth into kmz format, that also works – but since the file is no longer XML, I lose some of the “added value” features of my mashup.

I’ve scanned the Google documentation, but I could not find any reference to a maximum file size for kml files.

Any suggestions?

Here’s a code fragment that causes the problem in the Code Playground:

var map;
function zoomToGeoXML(geoXml) {
    var center = geoXml.getDefaultCenter();
    var span = geoXml.getDefaultSpan();
    var sw = new GLatLng(center.lat() - span.lat() / 2,
                    center.lng() - span.lng() / 2);
    var ne = new GLatLng(center.lat() + span.lat() / 2,
                    center.lng() + span.lng() / 2);
    var bounds = new GLatLngBounds(sw, ne);
    map.setCenter(center);
    map.setZoom(map.getBoundsZoomLevel(bounds));
}

function initialize() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_canvas"));
    var geoXml = new GGeoXml("http://(my base url)/files/gps/expr.kml",
                function() { zoomToGeoXML(geoXml); });
    map.addOverlay(geoXml);
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:02:08+00:00Added an answer on May 13, 2026 at 7:02 pm

    If you rearrange a few lines from Mike’s example, you get rid of the “side-effect that the map will initially be of the entire globe before zooming into the area defined by the kml file.”

    var map;
    
    function loadMapAndZoomToGeoXML(geoXml) {
        center = geoXml.getDefaultCenter();
        var span = geoXml.getDefaultSpan();
        var sw = new GLatLng(center.lat() - span.lat() / 2, center.lng() - span.lng() / 2);
        var ne = new GLatLng(center.lat() + span.lat() / 2, center.lng() + span.lng() / 2);
        var bounds = new GLatLngBounds(sw, ne);
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(center);
        map.setZoom(KmlMap.getBoundsZoomLevel(bounds));
        map.addOverlay(geoXml);
        map.enableScrollWheelZoom();
        map.setUIToDefault();
        map.addControl(new GLargeMapControl());
    }
    
    function initialize() {
        if (GBrowserIsCompatible()) {
            var geoXml = new GGeoXml("http://(my base url)/files/gps/expr.kml", function() { loadMapAndZoomToGeoXML(geoXml); });
        }
    }
    

    Unfortunately it ties up the business of loading the map with zooming it and centering it, but that can be refactored further. I wanted to stick to the example Mike gave as much as possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with a Google Maps mashup that has pushpins that are
I have some C# code that generates google maps. This codes looks at all
I have an application that uses the Google Maps API to geocode distances between
I have a button that launches the google maps app on my device via
I have a Google Maps app that takes up most of the page. However,
I have a google maps app that will resize the map div if its
After doing research I have discovered that Google Maps (on a webpage) will not
as part of my last.fm/google maps event mashup, I have to plot markers dynamically
I have an quite big CSv File I want to have in Google Maps
I have google maps added to UIWebview. I want to zoom the map to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.