{"action":"created","issue":{"url":"https://api.github.com/repos/naturalatlas/node-gdal/issues/125","labels_url":"https://api.github.com/repos/naturalatlas/node-gdal/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/naturalatlas/node-gdal/issues/125/comments","events_url":"https://api.github.com/repos/naturalatlas/node-gdal/issues/125/events","html_url":"https://github.com/naturalatlas/node-gdal/issues/125","id":110646536,"number":125,"title":"How to use /vsizip/ and /vsigzip/?","user":{"login":"TimJMartin","id":8383616,"avatar_url":"https://avatars.githubusercontent.com/u/8383616?v=3","gravatar_id":"","url":"https://api.github.com/users/TimJMartin","html_url":"https://github.com/TimJMartin","followers_url":"https://api.github.com/users/TimJMartin/followers","following_url":"https://api.github.com/users/TimJMartin/following{/other_user}","gists_url":"https://api.github.com/users/TimJMartin/gists{/gist_id}","starred_url":"https://api.github.com/users/TimJMartin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimJMartin/subscriptions","organizations_url":"https://api.github.com/users/TimJMartin/orgs","repos_url":"https://api.github.com/users/TimJMartin/repos","events_url":"https://api.github.com/users/TimJMartin/events{/privacy}","received_events_url":"https://api.github.com/users/TimJMartin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-10-09T12:21:13Z","updated_at":"2015-10-11T07:42:41Z","closed_at":null,"body":"Another basic question (sorry!)\r\n\r\nLooking at the codebase I can see that /vsizip/ and /vsigzip/ are in there but am really struggling to use them. I keep getting: error opening dataset.\r\n\r\nI have tried the following permutations\r\n\r\n```\r\nvar dataset = gdal.open('/vsigzip/hp40ne.gz')\r\nvar dataset = gdal.open('vsigzip/hp40ne.gz/hp40ne')\r\nvar dataset = gdal.open('/vsigzip/hp40ne.gz/, 'r', 'GML')\r\n```\r\n\r\nThere is even this entry in the ogrgml driver regarding the data I am trying to read:\r\n```js\r\n/* Might be a OS-Mastermap gzipped GML, so let be nice and try to open */\r\n    /* it transparently with /vsigzip/ */\r\n    else\r\n    if ( poOpenInfo->pabyHeader[0] == 0x1f && poOpenInfo->pabyHeader[1] == 0x8b &&\r\n         EQUAL(CPLGetExtension(poOpenInfo->pszFilename), \"gz\") &&\r\n         strncmp(poOpenInfo->pszFilename, \"/vsigzip/\", strlen(\"/vsigzip/\")) != 0 )\r\n    {\r\n        return -1; /* must be later checked */\r\n    }\r\n```\r\nThis made me think maybe I just needed to do\r\n```js\r\nvar dataset = gdal.open('hp40ne.gz') \r\n```\r\nBut this gave me the same error opening message.\r\n\r\nSorry for such a novice question ;)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/naturalatlas/node-gdal/issues/comments/147166921","html_url":"https://github.com/naturalatlas/node-gdal/issues/125#issuecomment-147166921","issue_url":"https://api.github.com/repos/naturalatlas/node-gdal/issues/125","id":147166921,"user":{"login":"BergWerkGIS","id":4549888,"avatar_url":"https://avatars.githubusercontent.com/u/4549888?v=3","gravatar_id":"","url":"https://api.github.com/users/BergWerkGIS","html_url":"https://github.com/BergWerkGIS","followers_url":"https://api.github.com/users/BergWerkGIS/followers","following_url":"https://api.github.com/users/BergWerkGIS/following{/other_user}","gists_url":"https://api.github.com/users/BergWerkGIS/gists{/gist_id}","starred_url":"https://api.github.com/users/BergWerkGIS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BergWerkGIS/subscriptions","organizations_url":"https://api.github.com/users/BergWerkGIS/orgs","repos_url":"https://api.github.com/users/BergWerkGIS/repos","events_url":"https://api.github.com/users/BergWerkGIS/events{/privacy}","received_events_url":"https://api.github.com/users/BergWerkGIS/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T07:42:41Z","updated_at":"2015-10-11T07:42:41Z","body":"> My hunch is this stems from node-gdal not being compiled with HAVE_LIBZ\r\n\r\n@brandonreavis yes, think so, too.\r\n\r\n\r\nInteresting though, that an exception is thrown, as [an error should be returned](https://github.com/naturalatlas/node-gdal/blob/047e430db06bcd066a9d30ec756610e9cc3b41d6/deps/libgdal/gdal/port/cpl_conv.cpp#L2700-L2753).\r\nI tried to `catch` the exception and access `gdal.lastError`, but it didn't contain anything.\r\n\r\n> I can try bundling zlib for portability\r\n\r\nGood idea, I also noticed that there seems to be some other zip functionality already (though I haven't looked in depth yet, if this would suffice for the `vsigzip` use case):\r\n\r\n```\r\ndeps/libgdal/gdal/port/cpl_minizip_*.*\r\n```\r\nhttps://github.com/naturalatlas/node-gdal/tree/master/deps/libgdal/gdal/port\r\n\r\nI will take a look at what exactly causes the crash during the next days."}}