Read KMZ with JavaScript

可紊 提交于 2019-12-24 01:25:33

问题


How I can read the content in a KMZ (not KML) with JavaScript?


回答1:


Well you need to see if it is possible to unzip the files. I would look at this stackoverflow post on using JavaScript. After that you will probably have a string of XML which you will need to convert to XML using the DOM parser.




回答2:


You have to use geoxml3.js with ZipFile.complete.js available at KMZ

     <script src="js/ZipFile.complete.js"></script>
     <script src="js/geoxmlv3.js"></script>

     var map = new google.maps.Map(document.getElementById(mapId), {
        zoom: 11,center: {lat: 0,lng: 0}
      });
      var myParser = new geoXML3.parser({
        map: map
      });
      myParser.parse(fileName);



回答3:


geoxml3 now supports kmz files (in the kmz branch).



来源:https://stackoverflow.com/questions/3498743/read-kmz-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!