AnsweredAssumed Answered

How to use a tpk in a webmap?

Question asked by FriediL on Apr 17, 2016

Hi. I want to add an satellite image as .tpk to a webmap (using javascript API). I found the following github site: which should make it easy. But unfortunately I am still having difficulties to use it. I have the feeling there is something missing in my code. I think the problem is that I don't quite understand the use of the BlobReader and what Blob actually should refer to.
Could anyone explain it to me?

      var map;
       function(Map ) {
       //unzip the tpk-file
, function (zipReader) {
               zipReader.getEntries(function (entries) {
                         console.log("Done reading zip file.")
               }, function (err) {
                    alert("There was a problem reading the file!: " + err);
       //create a new instance of TPKLayer
        tpkLayer = new O.esri.TPK.TPKLayer("localImage.tpk");

    //Listen for progress events to provide UX feedback
          tpkLayer.on("progress", function (evt) {
               evt == "start" ? = "visible" : = "hidden";
          map = new Map("map");
       tpkLayer.on("validationEvent", function(evt){
               //evt.msg is the string message
               //evt.err is the error 
               if(evt.msg == tpkLayer.NO_SUPPORT_ERROR){
                    //Let the user know the library isn't supported.
     // Listen for errors
          tpkLayer.on("databaseErrorEvent", function(evt){
               //evt.msg is the string message
               //evt.err is the error 
               if(evt.msg == tpkLayer.DB_INIT_ERROR){
                    //Let the user know there was a db problem.