-1

I am trying to load kmz files on my page. I tried two ways: The first method is by using:

 map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
    layer = new google.maps.KmlLayer('http://www.rwaafid.com/KMZ/geoxml3/1.kmz');
    layer.setMap(map);

This method is fast but it doesn't accept large kmz files and doesn't allow large number of layers. When I add certain number of layers, it stops drawing kmz into google map.


The first method is by using:

var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    var geoXml = new geoXML3.parser({
        map: map,
        singleInfoWindow: true,
        afterParse: useTheData
    });
        geoXml.parse('http://www.rwaafid.com/KMZ/geoxml3/1.kmz')
    }

This method works fine with some kmz files but with another files it takes very long time.


I tried both methods with the file : 'http://www.rwaafid.com/KMZ/geoxml3/1.kmz'

The first was very fast but it will not allow more files with more layers. The Second took more than two minutes to load the drawings into the map.

Is there any solution for this. I have been trying since more than a week to solve this issue. I appreciate any cooperation to this issue.

geocodezip
  • 158,664
  • 13
  • 220
  • 245
Khalid
  • 1
  • 1
  • What is your question? That is the way they work. `KmlLayer` has restrictions on the size of KML/KMZ files that can be loaded. `GeoXml3` doesn't have size restrictions, but does all the processing in the browser, so the bigger the data, the longer it will take. You could parse the KML/KMZ on your server and create tiles for the map, but that won't be simple, as you also have to implement any user UI required. – geocodezip Apr 27 '18 at 01:07
  • As geocodezip suggested, if this is a large KML/KMZ, then you're probably running into the limits of the Google Maps API. The current limits for KML & KMZ files are: - Maximum fetched file size (raw KML, raw GeoRSS, or compressed KMZ): 3MB - Maximum uncompressed KML file size: 10MB - Maximum number of network Links: 10 - Maximum number of total document-wide features: 1,000 - There is also a limit on the number of KML files, which is more complex and detailed in the documentation: https://developers.google.com/maps/documentation/javascript/kmllayer#restrictions – Christiaan Adams Apr 30 '18 at 15:44

1 Answers1

0

This service was able the display the map: GMap4 You might be able to discover what they are doing.

rheitzman
  • 2,247
  • 3
  • 20
  • 36