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 8025673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:14:26+00:00 2026-06-04T23:14:26+00:00

I am currently building a Google Maps project that will dynamically load and unload

  • 0

I am currently building a Google Maps project that will dynamically load and unload various KMZ files based on user input. It works fine for roughly 8 layer loads/unloads, but then Google Maps breaks down with the 414 error. I’ve traced the problem down to the stored string the API is generating to refer to each KML layer.

Here’s the code that runs when a layer is clicked:

function showLayer(layername) {
  if (layers[layername].kml === undefined) {
    layers[layername].kml = loadKML(layers[layername].file, layers[layername].options);
  }
  layers[layername].kml.setMap(map);
  redrawRoutes(layers[layername].kml);
}

And the loadKML function:

function loadKML(file, options) {
  var path = kmlDir + file;
  options = options || { preserveViewport: true };
  layer = new google.maps.KmlLayer(path, options);
  return layer;
}

Basically my goal is to only load each KML file once, store it in an object, and just reference that on subsequent loads/unloads. The problem here is that inside the Javascript Object that new google.maps.KmlLayer generates, a big long string

"kml:cj5TNh3iqySpI_DAGiDgbSJESQ-dakZTiMY09US6imjvFNPMTIIYNAg|ks:;dc:cg;ts:44610546|kv:3|api:3"

and appends this to the request URI each time. This adds up rather quickly, and after 7-8 appends the URI is too long and any subsequent requests are ignored.

Is there a way around using this long request string, can I force it to use a custom string, or just clear the URI each time? I will only be dealing with ~6 total files, and I’d really like to be able to handle as many layer loads/unloads as possible.

  • 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-06-04T23:14:27+00:00Added an answer on June 4, 2026 at 11:14 pm

    You are trying to optimize what Google already has. Google cache’s KML files and their associated tiles so there is very little penalty for destroying and recreating layers. As long as the url to the KML layer stays constant, you should just destroy then recreate the layer.

    Regardless of the number of KML files currently on the map, Google renders them as a single tile overlay. Your users have to download new tile images everytime you add/remove KML layers via setMap.

    Your KML file will only be accessed once every few hours. Supposedly, Google attempts to honor the cache headers issued for the request to the KML file. However, it’s not specifically defined how long Google will cache your KML when strong cache headers are missing.

    Google also imposes minimum caching times so that even if you were to specify via strong cache headers that your KML file should expire after 1 minute, Google would still cache the file for it’s preset (and undisclosed) time. The standard workaround is to add extra querystring parameters to the KML url in order to generate a new/unique address that hasn’t been previously cached.

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

Sidebar

Related Questions

I am currently building a site that utilises the Google Maps V3 API. It
I'm currently building a Web Service that sends files this also obtains the mime-type
Im building a website/webapp that uses sockets.io Currently if the user is using safari
I'm currently building an application that basically syncs files between a master directory and
I am currently building a location-based service that calculates routes for users sharing cars
I'm currently working on a Google Maps project and am implementing a search function.
I'm currently building a web application using Google Maps. Unfortunately, I've reached the absolute
I'm currently building a library around the Google Analytics Data Export API. When i'm
i am currently building a small utility library as part of a larger project.
I am currently building a C# application that is generating a random 9 digit

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.